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

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

Re: [LUG] Find & Replace across multiple files



Jonathan Melhuish wrote:
So I say:

for file in *; do sed -e 's/[control-set]*[/control-set]/[comment]controls removed from here[/comment]/g' $file > $file.new; mv $file.new $file; done

And it says:

sed: -e expression #1, char 69: Unknown option to 's'


The first option, after the 's' ('[control-set]*[/control-set]') has to be a valid regular expression. You are going to have to read `man regex`.


You will most likely just have to escape some of the characters you have used, for example:
\[control-set]*\[\/control-set]
(may work, but check man page)


Also escape (with a '\') the '/' character in the replace string.

--
Tom Salmon



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


Lynx friendly