On 6/5/07, Marc Espie [EMAIL PROTECTED] wrote:
On Mon, Jun 04, 2007 at 11:45:27PM +0200, Almir Karic wrote:
I don't see any -i option documented in the sed manpage.
-i on some seds (gsed, ssed, FBSD sed, maybe others) means ''in
place'' edit, that feature can be reimplemented with ''sed
hi, I'm using 3.8, and I hate to bother, but I have spent two days on the
net trying to find the answer to this problem.
I am using 'find' to batch file a sed search and replace. Sed, of course,
outputs to stdout, the problem I am having is finding the correct syntax so
that I can change the
On Mon, 4 Jun 2007, David B. wrote:
I am using 'find' to batch file a sed search and replace. Sed, of course,
outputs to stdout, the problem I am having is finding the correct syntax so
that I can change the extension of the input file to create the new output
file. For example:
Find .
On 6/4/07, David B. [EMAIL PROTECTED] wrote:
hi, I'm using 3.8, and I hate to bother, but I have spent two days on the
net trying to find the answer to this problem.
I am using 'find' to batch file a sed search and replace. Sed, of course,
outputs to stdout, the problem I am having is finding
Find . -name *.htm -exec 'sed s/old/new/' '{}'.new
the above command is probably a sytnax error, due to unterminated
-exec (add \; at the end to fix this), that apart that command should
look for a command 'sed s/old/new/' (note: it should NOT invoke sed
command with s/old/new/ argument).
On 2007/06/04 01:04, David B. wrote:
Find . -name *.htm -exec 'sed s/old/new/' '{}'.new
From what I've read, I should be able to use the '{}' as a global replace;
you pass {} to the shell as part of the filename to redirect the
output from find(1) to, it is not seen by find(1) at all (and
On Mon, Jun 04, 2007 at 12:30:49AM -0700, Bryan Irvine wrote:
On 6/4/07, David B. [EMAIL PROTECTED] wrote:
hi, I'm using 3.8, and I hate to bother, but I have spent two days on the
net trying to find the answer to this problem.
I am using 'find' to batch file a sed search and replace. Sed,
Hello!
On Mon, Jun 04, 2007 at 02:01:12PM +0200, Marc Espie wrote:
[...]
Don't use for loops with find results, they do not scale well.
Also, beware of spaces in file.
For this kind of thing, I generally use 'while read'
find . -type f -name \*.htm -print|while read f; do sed s/old/new $f
2007/6/4, Marc Espie [EMAIL PROTECTED]:
Don't use for loops with find results, they do not scale well.
Also, beware of spaces in file.
For this kind of thing, I generally use 'while read'
Use xargs(1)
Best
Martin
Hello!
On Mon, Jun 04, 2007 at 03:26:28PM +0200, Martin Schrvder wrote:
2007/6/4, Marc Espie [EMAIL PROTECTED]:
Don't use for loops with find results, they do not scale well.
Also, beware of spaces in file.
For this kind of thing, I generally use 'while read'
Use xargs(1)
For that case, it
A completely safe solution would be writing a small script:
#! /bin/sh
exec sed s/old/new/ $1 $1.new
and using find . -type f -name \*.htm -exec /path/to/script {} \;
or find . -type f -name \*.htm -print0 | xargs -0 -L 1 -r /path/to/script
...-exec sh -c 'something with $1' {} \; is fully
I think this is also correct:
find . -name '*.htm' -exec cp '{}' '{}'.new \; \
-exec sed -i s/old/new/ '{}'.new \;
Hannah Schroeter wrote:
Hello!
On Mon, Jun 04, 2007 at 02:01:12PM +0200, Marc Espie wrote:
[...]
Don't use for loops with find results, they do not scale well.
Also, beware
Hello!
On Mon, Jun 04, 2007 at 06:27:41PM +0200, Almir Karic wrote:
A completely safe solution would be writing a small script:
#! /bin/sh
exec sed s/old/new/ $1 $1.new
and using find . -type f -name \*.htm -exec /path/to/script {} \;
or find . -type f -name \*.htm -print0 | xargs -0 -L 1 -r
...-exec sh -c 'something with $1' {} \; is fully safe as well.
sh -c 'echo foo$1bar' baz
- foobar
Seems not.
a typo, sorry, it should be sh -c 'echo foo$1bar' -- baz
i am cheating tho, and have sh symlinked to bash.
--
almir
Hi!
On Mon, Jun 04, 2007 at 06:54:20PM +0200, Tom Van Looy wrote:
I think this is also correct:
find . -name '*.htm' -exec cp '{}' '{}'.new \; \
-exec sed -i s/old/new/ '{}'.new \;
I don't see any -i option documented in the sed manpage.
Kind regards,
Hannah.
Hi!
On Mon, Jun 04, 2007 at 07:49:08PM +0200, Almir Karic wrote:
...-exec sh -c 'something with $1' {} \; is fully safe as well.
sh -c 'echo foo$1bar' baz
- foobar
Seems not.
a typo, sorry, it should be sh -c 'echo foo$1bar' -- baz
This works indeed. But better use the additional quotes
On Mon, Jun 04, 2007 at 02:25:00PM +0200, Hannah Schroeter wrote:
Hello!
On Mon, Jun 04, 2007 at 02:01:12PM +0200, Marc Espie wrote:
[...]
Don't use for loops with find results, they do not scale well.
Also, beware of spaces in file.
For this kind of thing, I generally use 'while read'
On 6/4/07, Hannah Schroeter [EMAIL PROTECTED] wrote:
Hi!
On Mon, Jun 04, 2007 at 06:54:20PM +0200, Tom Van Looy wrote:
I think this is also correct:
find . -name '*.htm' -exec cp '{}' '{}'.new \; \
-exec sed -i s/old/new/ '{}'.new \;
I don't see any -i option documented in the sed
\ This works indeed. But better use the additional quotes around $1. Just
get used to them, because $1 could contain IFS characters.
true, but in this case it doesn't really matter how shell splits words :)
i am cheating tho, and have sh symlinked to bash.
Why?
i learnt to use bash,
On Mon, Jun 04, 2007 at 11:45:27PM +0200, Almir Karic wrote:
I don't see any -i option documented in the sed manpage.
-i on some seds (gsed, ssed, FBSD sed, maybe others) means ''in
place'' edit, that feature can be reimplemented with ''sed '' file
new_file; mv -g new_file file'' (it
Hello!
On Mon, Jun 04, 2007 at 11:45:27PM +0200, Almir Karic wrote:
\ This works indeed. But better use the additional quotes around $1. Just
get used to them, because $1 could contain IFS characters.
true, but in this case it doesn't really matter how shell splits words :)
Proactive security
Hello!
On Mon, Jun 04, 2007 at 04:37:17PM -0500, terry tyson wrote:
On 6/4/07, Hannah Schroeter [EMAIL PROTECTED] wrote:
On Mon, Jun 04, 2007 at 06:54:20PM +0200, Tom Van Looy wrote:
I think this is also correct:
find . -name '*.htm' -exec cp '{}' '{}'.new \; \
-exec sed -i s/old/new/
22 matches
Mail list logo