Hello All,
I have a text file containing output from a command that contains lots of escape/control characters that when viewed using vi or view, looks like jibberish. But when viewed using the cat command the output is formatted properly.
Is there any way to take the output from the cat command, exactly how it is displays in the terminal and print it to another text file...?
So basically it would be like the new text file contains the interpreted output of the first file. Almost as though I just copy and pasted the terminal output to a text file, so the new text file wouldn't show the control characters... Does that make sense?
For example:
One line from file1.txt Contains:
server 37290556^[[29G4.5 user
Then `cat` prints:
server 37290556 4.5 user
I've tried a few different things like redirection of cat, the tee command, and 'echo -e' like this:
echo -e "$(cat file.txt)" > new_file.txt
But nothing is getting me the results I'm looking for.
Each new file that gets written to from the attempts I mentioned above, contains the EXACT same data as the original file.
If anyone has ANY thoughts or suggestions, it would be greatly appreciated.!
Thanks in Advance,
Matt