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 01-02-2009
Christoph Spohr Christoph Spohr is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 205
Hi,


Code:
sed 's/a\(..\)a/\1/' <<< "abba"

output:

Code:
bb

The backreference \1 saves the two characters betweens the as.
Everything between \(\) is saved and can be refereced with
\1 to \9 for each \(\).

HTH Chris