views:

34

answers:

1

When i run script to log the entire console , the output file is crytpic with symbols like ^[d ^M ^[ ^@ ^@ etc.. Is there a editor which will remove and open the file that looks like exact console logs .....

+1  A: 

Yes sir, your editor is sed. :D

Try the following command:

$ sed -E "s/[[:cntrl:]](\[K[0-9]? ?)?//g" your_file_here > output_file

That should remove all of the control characters (the characters you described) from your file.

Zachary Murray
This looks good, just the `-E` should be `-e`; or you can skip it altogether...
nik
The `-e` is required for combining multiple commands. When you have just one command (as in this case, the part between double quotes) it is not required.
nik
I used -E for the extended version of regular expressions. From the sed man page:"-E: Interpret regular expressions as extended (modern) regular expressions rather than basic regular expressions (BRE's). The re_format(7) manual page fully describes both formats."
Zachary Murray