vi and sed questions

Tapani Tarvainen tarvaine at tukki.jyu.fi
Mon Sep 18 04:39:07 AEST 1989


In article <4370002 at hpavla.HP.COM> rowland at hpavla.HP.COM (Fred Rowland) writes:
>Two questions about editing; one about vi and one about sed!
[vi question deleted]

>	The file used in the above example is a mail list which
>has to be converted into labels.  I add three @ symbols to the end
>of each line, then convert all of them to newlines.  I can do this
>in vi but I get substitution overflows as the file grows considerably
>in size.  I would prefer to use sed, but how do you tell sed to
>split a line (generate a newline)?  I've tried various 
>combinations of \(Return), \n, CTRL-V, and such but nothing
>works.  I EVEN READ THE MANUAL!  It told me to use \n and
>gave an example.  It didn't work.  This has to be possible, but
>how?

Strange.  The following 2-line sed script does it just fine for me:

s/@/\
/g

(Nothing invisible in there, just what it looks like.)
Just tried it on four machines (SunOS 4.0, HP-UX 6.5, BSD4.3 in a VAX
and GNUSED in MS-DOS) and it worked just as I expected in them all.
The only problem with this I can think of is that if you're using
csh or tcsh you have to put the script in a file and use the -f option.
What machine, OS and shell are you using?

-- 
Tapani Tarvainen    (tarvaine at tukki.jyu.fi, tarvainen at finjyu.bitnet)



More information about the Comp.unix.wizards mailing list