shell pipeline to reverse the order of lines.

Mario Wolczko mario at cs.man.ac.uk
Thu Feb 21 08:17:34 AEST 1991


> In <9102151917.AA04419 at wendy-fate.UU.NET> kyle at UUNET.UU.NET (Kyle Jones):
> 
>    After seeing a couple of programs in Perl and Icon to do this, I
>    feel compelled to post a shell pipeline solution to this problem.
> 

Pass\'e solution, man.  Try this:
	ed - file <<\x
	g/^/m0
	w
	q
	x

Haven't you ever played "quiz function ed-command"? :-)

Mario Wolczko

PS Before anyone complains it's not a pipeline:
(cat >/tmp/pp$$ ; ed - /tmp/pp$$ <<\x ; cat /tmp/pp$$ ; rm /tmp/pp$$)
g/^/m0
w
q
x

   ______      Dept. of Computer Science   Internet:      mario at cs.man.ac.uk
 /~      ~\    The University              uucp:      mcsun!ukc!man.cs!mario
(    __    )   Manchester M13 9PL          JANET:         mario at uk.ac.man.cs
 `-':  :`-'    U.K.                        Tel: +44-61-275 6146  (FAX: 6280)
____;  ;_____________the mushroom project___________________________________



More information about the Alt.sources.d mailing list