Sed replace from another file
From: Matt (SPAMmchildersNO_at_gmail.com)
Date: 02/24/05
- Next message: Paul D: "gssftpd"
- Previous message: rpl: "compress on RH 9"
- Next in thread: Tommy Reynolds: "Re: Sed replace from another file"
- Reply: Tommy Reynolds: "Re: Sed replace from another file"
- Reply: noi: "Re: Sed replace from another file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 24 Feb 2005 16:57:58 -0600
I have posted here several times the last week, and you all have been so
helpful, hopefully this will be the last question... I need some help
gettting sed to replace a line in one file with a more detailed line in
another file. I'm trying to get the following to work:
$cat foo
1234
1235
1236
$cat bar
Device 1 (1235)||1235||{AEA2A6E7-FBFD-4472-92E9-8F9E2C16AF4F}
Device 2 (1236)||1236||{ASA2F2E4-FGFA-4492-8E2B-FF2A59C16B7A}
Device 3 (1234)||1234||{9D30891C-2539-4A56-A138-879F7B4988AA}
$ sed foo -e 'magical sed statement'
Device 3 (1234)||1234||{9D30891C-2539-4A56-A138-879F7B4988AA}
Device 1 (1235)||1235||{AEA2A6E7-FBFD-4472-92E9-8F9E2C16AF4F}
Device 2 (1236)||1236||{ASA2F2E4-FGFA-4492-8E2B-FF2A59C16B7A}
I have tried the follwoing to no avail:
$ sed foo -e "s;\(\|\|.*\|\|\);cat bar | grep \\\1`/g"
grep: Invalid back reference
However, I can get this to work, which lets me know that I can use the \\\1
to get the text I want to be executed in the command, but it just doesn't
seem to work with grep.
$ sed foo -e "s;\(\|\|.*\|\|\);`echo \\\1`;g"
1234
1235
1236
Does anyone know what I need to do to get this working? Any help would be
appreciated.
Thanks again,
Matt
- Next message: Paul D: "gssftpd"
- Previous message: rpl: "compress on RH 9"
- Next in thread: Tommy Reynolds: "Re: Sed replace from another file"
- Reply: Tommy Reynolds: "Re: Sed replace from another file"
- Reply: noi: "Re: Sed replace from another file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|