D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [Fwd: Re: [LUG] Find & Replace across multiple files]



Jonathan Melhuish wrote:
On Monday 02 December 2002 1:50 pm, you wrote:
[jon@xxxxxxxxx pages]$ for file in *; do sed -e's/\[control-set]*\[\/control-set]/\[comment]control_removed\[\/comment]/g' $file > $file.new; mv -f $file.new $file; done
sed: can't read aboutus.html.new: No such file or directory

Not sure about this one, probably sed failed to output the file, for some reason. Files ending .new are only temporary, there should be none present before or after.


sed: read error on {Unknown file pointer}: Is a directory
sed: read error on {Unknown file pointer}: Is a directory
sed: read error on {Unknown file pointer}: Is a directory
sed: read error on {Unknown file pointer}: Is a directory
sed: read error on {Unknown file pointer}: Is a directory
sed: read error on {Unknown file pointer}: Is a directory

That command cannot be used on directories. If your files are in many directories a more complex script will be required that combines `find` and `sed`.


If the files are all in one directory, use 'for file in *.html ...'


I'm sorry to keep pestering you, I ought to be able to fix these problems myself, but I'm a bit of a command-line newbie (a Child of Windows, now becoming slowly converted to a Brother of Unix).



Takes time, and there's plenty to learn. If you get chance to read the man pages for sed and find, best do so. A copy of 'Linux in a Nutshell' will do you well.


--
Tom Salmon


-- The Mailing List for the Devon & Cornwall LUG Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the message body to unsubscribe.


Lynx friendly