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]



On Monday 02 December 2002  1:50 pm, you wrote:
I'll forward you what I've already posted to the list, seems pointless
to repost to the list. (probably some problem on some server)

Yeah, it's bizarre, I dunno where the hell my message or your reply got to!

Hope this helps. Let me know if you're still having problems.

Unfortunately I am:

[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
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

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).

Jon

-------- Original Message --------
Subject: Re: [LUG] Find & Replace across multiple files
Date: Sun, 01 Dec 2002 22:17:40 +0000
From: Tom Salmon <tom@xxxxxxxxxxxxx>
To: list@xxxxxxxxxxxx
References: <02113010270303.02320@xxxxxxxxxxxxxxxxxxxxx>
<3DE92532.10302@xxxxxxxxxxxxx> <02113013342004.02320@xxxxxxxxxxxxxxxxxxxxx>

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.

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


Lynx friendly