Hello,
I need to remove ^L character from a file as below:
HELLO "I "
HELLO "I "
^L HELLO "I"
HELLO "I "
HELLO "I "
Please suggest.
Thanks !!
Hello,
I need to remove ^L character from a file as below:
HELLO "I "
HELLO "I "
^L HELLO "I"
HELLO "I "
HELLO "I "
Please suggest.
Thanks !!
sed 's/^[ \^L]*//' file
Sorry, didnt work .... actually this character is only visible in vi editor. If we do cat it simply shows a space as below:
HELLO "I "
HELLO "I "
HELLO "I"
HELLO "I "
HELLO "I "
Try
awk '/^\014/{sub("\014","")}1' inputfile
$ awk '/^\014/{sub("\014","")}1' x
awk: syntax error near line 1
awk: illegal statement near line 1
awk: syntax error near line 1
awk: bailing out near line 1
Solaris???
Use /usr/xpg4/bin/awk instead of awk...
Thanks bro it worked yeah its solaris .... Have to put it across 50 servers .. hope all of them have /usr/xpg4/bin/awk
Ctrl/L is a Formfeed character.
The easiest way to remove them is with the tr command. Should be available on every version if unix.
cat inputfile | tr -d '\f' > outputfile
Hi,
I have seen this syntax a few times. Could you please explain, what's the "1" at the end of awk statement doing in this code snippet. Thanks.
It's a pattern (which is always true) without any action. You can replace it with any non-zero number. As the default action in awk is to print, this will output each input record (if control reaches there for that record).