Justin Ballou wrote:
> > I was sent an html file that has no newlines in anything that I can find
> > on my box. I have tried vi gnotepad gedit ghex. Netscape view->page
> > source renders it correctly. vi shows a bunch of ^M where the newlin
> > should be so I tried:
> >
> >:%s/ctrl-vctrl-M/\n/g to no avail. I am afraid this is the extent of my
> > vi skills. ghex shows the offending char as 0D. How can I convert this
> > file to some thing I can read and edit?
>
> There are at least a couple of ways you could do this with vi and tr or
> perl. In vi, from the first line of the file,
>
> [ESC]:!Gtr '\015' '\012'
I am not familier with this syntax thanks. I assume that this is opening a
shell and running the tr command on the file? is the G for global? The
octal syntax is what I was looking for last night. how do you get vi to
search and replace on octal or hex values? spent an hour looking before I
gave up.
>
>
> should do it, or
>
> [ESC]:!Gperl -pe 's/\015/\012/g'
>
a variant of this from the command line was my solution. I used the hex
values though.
perl -pe 's/\x0D/\x0A/g'
Very easy once you get going the right direction. Thanks to all that
helped. This thread is one I intend to file away. I don't do this enough to
remember each time but when I need it ...
BTW can you pass vi commands to vi from the command line? I thought I saw
an example of this but can't find it in the archives.
Bret
_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list