🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #288

Re: sed help needed

#288
From: Tom Christiansen
Date: Tue, 04 Aug 1992 16:33
35 lines
1851 bytes
From the keyboard of ltaylor@blinky.East.Sun.COM (Laura Taylor):
:i figured out the answer to the last question i posted myself:
:
:set result = `grep "search string" searchfile | awk '{print $3}' | uniq`
:
:piping through uniq was the ticket.

I'll bet sort -u will work better than uniq.  Check the docs.

Oh my, that does look like a csh script, doesn't it?  I'll
bet you've got other problems awaiting you.

:however, now a new problem arises.
:
:my variable $result = /some/long/unix/directory
:
:i want to use sed to replace it with /some/other/long/unix/directory
:
:the sed command should be something like this:
:
:sed s/$result/"/some/other/long/unix/directory"/ searchfile > newfile 
:
:however this doesn't work. the problem is definitely related to the
:"/"es in the unix tree names. anyone know what is wrong with this
:sed string?

    s!/this/and/that!another/thing/here!


--tom
-- 
    Tom Christiansen      tchrist@convex.com      convex!tchrist

User n.:
        A programmer who will believe anything you tell him.
Technical Details
Message-ID: <1992Aug4.163347.27012@news.eng.convex.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ames!haven.umd.edu!darwin.sura.net!convex!convex!tchrist
References: <15mao8INN6ee@seven-up.East.Sun.COM>

Show Full Headers
Complete Article Headers
Newsgroups: comp.unix.shell
Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ames!haven.umd.edu!darwin.sura.net!convex!convex!tchrist
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: sed help needed
Originator: tchrist@pixel.convex.com
Sender: usenet@news.eng.convex.com (news access account)
Message-ID: <1992Aug4.163347.27012@news.eng.convex.com>
Date: Tue, 4 Aug 1992 16:33:47 GMT
Reply-To: tchrist@convex.COM (Tom Christiansen)
References: <15mao8INN6ee@seven-up.East.Sun.COM>
Nntp-Posting-Host: pixel.convex.com
Organization: CONVEX Realtime Development, Colorado Springs, CO
X-Disclaimer: This message was written by a user at CONVEX Computer
              Corp. The opinions expressed are those of the user and
              not necessarily those of CONVEX.
Lines: 35