The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 12-11-2001
Jimbo
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
Well, sounds like homework to me, but looks like you have already put in the effort, and close to a solution, so I will reply (and chastise me if I shouldn't have, guys).

My solution does not use $1 (I need a little sed research myself), but instead uses \1 to back-reference the 1st parenthesized expression:

echo 'your input line' |
sed "s/the data is {\(.*\)}/the string was \(\"\1\"\)/"

and I did not have to escape the braces with backslashes.

Jimbo