Hi
I have a file with lots of line feeds and form feeds (page break). Need to replace last occurrence of form feed (created by - echo "\f" ) in the file with line feed.
Please advise how can i achieve this.
TIA
Prvn
Hi
I have a file with lots of line feeds and form feeds (page break). Need to replace last occurrence of form feed (created by - echo "\f" ) in the file with line feed.
Please advise how can i achieve this.
TIA
Prvn
do mean this??
home> cat vv.txt
hi
this is
vidyadharhome> awk '1' vv.txt
hi
this is
vidyadhar
home>
Try this to replace the formfeeds:
sed 's/^L/^M/' file > newfile
To get the ^L type <Ctrl>-V and <Ctrl>-L, for the ^M type <Ctrl>-V and <Ctrl>-M.
Regards
Thank you Franklin52,
It worked great but i need it to replace only for LAST occurrence of Form-feed (its doing for ALL occurrences now)
I tried the below to achieve this but no use, Please advise
sed 's / \ (.* \) ^L/\1^M/' file >file1
Prvn
There's an imperfection the first solution, it replaces the formfeeds with a CR instead of a linefeed. This should replace the last formfeed in a file with a linefeed, supposing it's on the last line (the command must be on 2 lines!):
sed '$ s/^L/\
/' file
Regards
It worked perfectly!
Thank you very much for your help!!