On Tue, Feb 13, 2001 at 11:14:24AM -0500, Anthony E . Greene <[EMAIL PROTECTED]> wrote:
| On Tue, 13 Feb 2001 07:48:10 Kiran Kumar M wrote:
| >I have a file with characters might be carriage returns. The file looks
| >like the following (I opened it in vi)
| >
| > ^M ^Maaaa
| > ^M ^Mbbbb
| > ^M ^Mcccc
| >
| >I want to convert to
| >
| >aaaa
| >bbbb
| >cccc
| >
| >I want to omit the extra characters..
|
| So open the file in vi/vim and use the "x" key to delete the unwanted characte
rs, then "ZZ" to save and quit.
It's just possible the file is more than 3 lines...
You can do this:
sed 's/.*^V^M//' file >new-file
That's typing a control-V and then a control-M; the idea is to get just
a literal ^M into the sed command, and since ^M is truned into
end-of-line by the tty driver you need to preceed it with ^V
(literal-next) to say "no no! I really did mean ^M!".
You can do a similar thing from within vi using the : command mode.
--
Cameron Simpson, DoD#743 [EMAIL PROTECTED] http://www.zip.com.au/~cs/
USA Today has come out with a new survey - apparently, three out of every
four people make up 75% of the population. - David Letterman
_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list