Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Search and Destroy

3 views
Skip to first unread message

Thomas A. Keesee

unread,
Sep 6, 1995, 3:00:00 AM9/6/95
to
I have a bunch of text files that contain strings containing /u. I no
longer want them to contain /u ex: /u/appl/ should be /appl/....

Should I use awk? sed? Help!

Todd Cormack
Atlanta, GA


Hemant Shah

unread,
Sep 6, 1995, 3:00:00 AM9/6/95
to
Thomas A. Keesee (cpa...@ix.netcom.com) wrote:
->I have a bunch of text files that contain strings containing /u. I no
->longer want them to contain /u ex: /u/appl/ should be /appl/....

->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.
--------------------------------------------------------------------------

Randal L. Schwartz

unread,
Sep 6, 1995, 3:00:00 AM9/6/95
to

This week's Useless Use of Cat Award goes to...

"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

Dana French

unread,
Sep 7, 1995, 3:00:00 AM9/7/95
to cpa...@ix.netcom.com
A sed script would be easy to use here, such as

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

System administrator

unread,
Sep 8, 1995, 3:00:00 AM9/8/95
to
Hemant Shah (sh...@flood.xnet.com) wrote:

> 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!

0 new messages