1 |
On Wed, Apr 30, 2008 at 06:02:38PM +0200, Penguin Lover Alan McKinnon squawked: |
2 |
> On Wednesday 30 April 2008, Matthew R. Lee wrote: |
3 |
> > I have a folder full of .html files and I need to go through and |
4 |
> > replace in each and every one of them a couple of bits of info. I |
5 |
> > know I can do this using the following from the command line: |
6 |
> > sed 's/VV, ppp-ppp/81, 51-67/' file.html > newfile.html | mv |
7 |
> > newfile.html file.html |
8 |
> |
9 |
> Somehow somewhere you can accomplish what you want in one line with a |
10 |
> suitable combination of locate, find, grep, for, xargs, sed and awk |
11 |
|
12 |
Right, as an addendum to my other solution, in the case where files |
13 |
are spread across a directory tree, run the following in the base |
14 |
directory of tree: |
15 |
|
16 |
find ./ -name "*.html" -exec sed -i.bkup 's/VV, ppp-ppp/81, 51-67/' {} + |
17 |
|
18 |
(yes, that's a '+' character at the end). You can, of course, tweak |
19 |
the parameter to find to get finer control of exactly which files you |
20 |
want modified; this is left as an exercise to the reader. |
21 |
|
22 |
W |
23 |
-- |
24 |
Introducing: the |
25 |
Universal Conterexample Matrix |
26 |
[ 0 1 ] |
27 |
[ 0 0 ] |
28 |
if you ever suspect a statement is false for linear transformations, |
29 |
it will be false for the Universal Counterexample Matrix. |
30 |
~Prof. Edward Nelson. MAT 217. P-town |
31 |
Sortir en Pantoufles: up 509 days, 14:49 |
32 |
-- |
33 |
gentoo-user@l.g.o mailing list |