| View previous topic :: View next topic |
| Author |
Message |
cz0 Apprentice

Joined: 13 Jun 2005 Posts: 171 Location: /earth/russia/moscow
|
Posted: Wed Jul 01, 2009 6:56 am Post subject: [DUP] [CLOSED] sed regexp tamplate, covering 3 strings |
|
|
Hi folks!
I'm trying to make a tamplate for sed (s command) to replace 3 strings, looking like this:
;aaaaaaa
;bbbbbbb
;cccccccc
with strings like this:
aaaaaaa
bbbbbbb
ddddddd
but as it's 3 strings new line eatch, I have no clue how to make a tamplate. sed is called from bash script. I've tryed something like this:
| Code: |
cat filename | sed 's/;aaaaaaa{/*/*}/somthing'
|
and
| Code: |
cat filename | sed 's/;aaaaaaa{
/*
/*
}/somthing'
|
and bad luck
Can anybody help me as I'm already feeling sick of it. |
|
| Back to top |
|
 |
klixon n00b


Joined: 14 Feb 2006 Posts: 39 Location: Holland
|
Posted: Wed Jul 01, 2009 9:18 am Post subject: |
|
|
s/;\(.\)/\1/
for readability: s|;\(.\)|\1|
the \1 in the replacement is a reference to the part between brackets in the regexp _________________ Stand back, intruder, or I'll blast you out of space. I am Klixon and I don't want any dealings with you human lifeforms... I'm a cyborg! |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|