The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM



Thread: sed regex
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 01-30-2002
Shakey21
Guest
 

Posts: n/a
sed regex

I would like to do this:

replace the word "prod" with the word "special" but it may occur through the file naturally without a command, I only want it to happen when it has a specific command in front of it. The command will always look like this

<IMG,###,###,##,>prod/directory/IMG/file

Now the numbers (parameters can happen numerous times or not ) so it can look like this <IMG,320,123,2,2,1,1,1,1,2>prod/... or like this <IMG,100,100,2,2>prod/...

What I have at the moment is sed s/"\>prod"/"\>special"/g but I want it to include the command as the regex and it has to go back in front of the word the same way.

Any suggestions to a safer regex?

I was thinking something like this or along these lines: (but it doesn't work and i am not really familiar with the ".*")

sed s/\(IMG,.*\)prod/\1special/

Thanks in anticipation!
Forum Sponsor