Computing.Net > Forums > Unix > dumb sed question

dumb sed question

Reply to Message Icon

Original Message
Name: ronaldfinkbine
Date: July 28, 2005 at 07:56:06 Pacific
Subject: dumb sed question
OS: XP; linx
CPU/Ram: varies
Comment:

I am using sed to replace a string in a file with a file. From looking at the sed help docs on the www this should work

sed "s/XXX/r quote/" <infile >outfile

but obviously, it does not.

I am using sed in a DOS window on XP, but this is such an old tool it should work the same everywhere.

confused, I am

Ron
ronaldfinkbine@hotmail.com


Report Offensive Message For Removal

Response Number 1
Name: Jim Boothe
Date: July 28, 2005 at 12:07:26 Pacific
Subject: dumb sed question
Reply: (edit)

That command will read each line of infile, will print each line (modified or not) to stdout, and the stdout is being redirected to a file named outfile.

Regarding the string replacement, the first XXX found on a line would be changed to "r quote". On that same line, subsequent occurrences of XXX would not be changed (the /g flag would cause all occurrences to be changed).


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: dumb sed question

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software