SED!

der.hans plug-discuss@lists.plug.phoenix.az.us
Mon, 22 Apr 2002 20:48:57 -0700 (MST)


Am 21. Apr, 2002 schwätzte Support so:

> Any sed gurus on the list? I use it often in a class I am taking but I
> am stuck on this one and have had no luck with the docs I have found.
> What I need to do is append 'z=z+' to the beginning of every line in a
> file.
>
> The file looks like this:
>
>                  1234960
> 		1456780
> 		3456567
> 		5476865
> 		456098
>
> thats it 1 simple column! Maybe I need some sleep it is 1 am here in
> Germany.
>
> Thanks for any help!
> (I know you are out there der hans) :)

Sorry, my Net connection was down for the weekend :(.

116 pieces of mail for PLUG-discuss waiting for me this afternoon, though.

perl -p -e 's/(.*)/z=z+$1/' resolv.conf   # ;-)

Why use a good tool like sed when you have the Swiss-Army-Club at your
disposal? :)

You already got good sed answers, though.

perl -pi.bak -e 's/(.*)/z=z+$1/' fileName

The second one saves the orig file to fileName.bak and puts the new data in
fileName.

Anyone want to demo how to do this in the other p languages? PHP? Python?
Prolog? :)

Command line versions only, please :).

ciao,

der.hans
-- 
#  https://www.LuftHans.com/
#  Perl is the answer, you just don't want to know the question... - der.hans