[PLUG] To the VI Question

Matt Alexander m at netpro.to
Mon Jul 15 20:06:09 UTC 2002


Here's how I generated the list:

I have a text file with email addresses and a bunch of other information
separated by semi-colons.  The email address is the first field, so I used
cut to pull it out like this:

cut -f1 -d\; myfile > newfile

So when I use :%s/\n/,/ it doesn't work.  I'm using vi (vim) on a RH 7.3
box.  I can still get what I want by doing this, however:

:%s/$/,/

And then doing 999J to join all the lines.

Is there something special about the cut command that doesn't put in the
newlines?
Thanks,
~M

On Mon, 15 Jul 2002, Dan Young wrote:

> Did you get the slash before the n? "\n" is the newline character.
>
> :%s/\n/,/
> 	#correct
>
> worked for me on the list you gave. Whereas:
>
> :%s/n/,/
> 	#incorrect
>
> would replace "n" w/ "," like you mentioned.
>
> -Dan Young
> -Parkrose School District
>
> Matt Alexander wrote:
> > Hmmm...  that just replaced all the letter n's with a comma.
> >
> >
> > On Mon, 15 Jul 2002, Jason Dagit wrote:
> >
> >
> >>I deleted the email so quick that I can't reply, but here how I did it:
> >>
> >>:%s/\n/, /
> >>or
> >>:%s/\n/,/
> >>
> >>depends on if you want the extra space.
> >>
> >>The idea is that %s is the whole file, \n is the end of line.
> >>
> >>I hope this helps.
> >>Jason
>
>
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>





More information about the PLUG mailing list