Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sed question

Status
Not open for further replies.

dickiebird

Programmer
Feb 14, 2002
758
GB
Guys
I'm missing something in my sed education
I want to put some | (pipe) in my file, before and after
some numbers.
So I tried sed 's/ [0-9]/| [0-9]/g' >newfile
This finds any numbers preceded by a space just fine, but
then puts '[0-9]' there too.
Any thoughts to put me on the right track ?
;-) Dickie Bird
db@dickiebird.freeserve.co.uk
 
Fixed it meself !
sed 's/ [0-9]/| &/g' > newfile

The & represents the pattern that was matched !
Dickie Bird
db@dickiebird.freeserve.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top