Operating System - Linux
1752634 Members
5984 Online
108788 Solutions
New Discussion юеВ

Re: Remove ^I, ^L in file

 
Paola Guizado
Occasional Contributor

Remove ^I, ^L in file

Hi.
Please your help.

I have a file and I do want to remove him these symbols ^I, ^L like I make?

Thanks very much.
With the command sed i used this,
sed '$d' file1 > file2
thinking in that the symbol was at the end of the file
but it should not always be this way. it is better than it validates in the whole file.
5 REPLIES 5
James R. Ferguson
Acclaimed Contributor

Re: Remove ^I, ^L in file

Hi:

# perl -ple 's%\011%%g;s%\014%%g' file

The ^I is a horizonal tab; The ^L is a formfeed. See the manpages for 'ascii(5)'.

By the way, please evaluate and assign points to the responses to your previous question:

https://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1177271

See:

http://forums1.itrc.hp.com/service/forums/helptips.do?#28

Regards!

...JRF...
James R. Ferguson
Acclaimed Contributor

Re: Remove ^I, ^L in file

Hi (again):

If you prefer, you could also use the control keys and letters (Ctrl-I and Ctrl-L) to compose a 'sed' substitution:

# sed -e 's/ //g' -e 's/^L//g'

Note that the tab character composed as CTRL-I will appear as whitespace in this post.

Regards!

...JRF...




Sandman!
Honored Contributor

Re: Remove ^I, ^L in file

# tr -s '\011\014' ' ' < file
Geoff Wild
Honored Contributor

Re: Remove ^I, ^L in file

You can also use vi


:g/^L/s///


ctrl-l has to be entered with the key strokes:

ctrl-v followed by ctrl-l

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Arturo Galbiati
Esteemed Contributor

Re: Remove ^I, ^L in file

Hi,
you can use strings ,file> to remove any control chars from your file.
Just my .02$.
HTH,
Art