Should I use awk? sed? Help!
Todd Cormack
Atlanta, GA
->Should I use awk? sed? Help!
->Todd Cormack
->Atlanta, GA
cat file | sed -e "s!/u/!/!"
--
\\|//
(O-O)
---------------------------------------------------------oOO--(_)--OOo-----
Hemant Shah | I haven't lost my mind,
LIDP, Inc. | it's backed up on tape somewhere.
Voice: (708) 960 0133 Ext: 64 |
Fax: (708) 960 0717 |
E-mail: sh...@xnet.com | My opinions are mine only. Others can
WWW: http://www.xnet.com/~shah | have their own.
--------------------------------------------------------------------------
"Hemant" == Hemant Shah <sh...@flood.xnet.com> who writes:
Hemant> cat file | sed -e "s!/u/!/!"
which, using the simple rule that:
cat fred | barney junk junk junk ...
can nearly always be rewritten as:
<fred barney junk junk junk ...
would look like this:
<file sed -e "s!/u/!/!"
But of course, we can go one further, because we know the operation of
"sed", and can put the file as one of the arguments:
sed -e "s!/u/!/!" file
and there you have it.
Stay tuned for next week's "Useless Use of Cat Award" (I'd bet the rent
money that there'll be another one).
Just another Useless Use of Usenet Award Winner,
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <mer...@stonehenge.com> Snail: (Call) PGP-Key: (finger mer...@ora.com)
Web: <A HREF="http://www.teleport.com/~merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
for i in `ls file*.txt`
do
cat ${i} | sed -e "s|/u||g" > /tmp/tmp.out
mv /tmp/tmp.out ${i}
done
--
Dana French E-Mail: dfr...@aig.com
Applied Intelligence Group Phone: (405) 341-7700
501 East 15th Street, Suite 202 Fax: (405) 341-8898
Edmond, OK 73013
> cat file | sed -e "s!/u/!/!"
The cat is useless:
sed -e "s!/u/!/!" file
Heiner
--
------------------------------------------------------------------
/ Heiner Steven, Nuernberg hei...@hsysnbg.nbg.sub.org /
/ World, Europe, Germany, Nuernberg h...@bintec.de /
------------------------------------------------------------------
:q!ZZ^X^Cquit^Mexit^J^D^Cbye^Mlogout^M^?^\alles kacke!