1 |
-----BEGIN PGP SIGNED MESSAGE----- |
2 |
Hash: SHA1 |
3 |
|
4 |
This should work (untested!): |
5 |
|
6 |
for x in $(find <YOUR-DIR-WITH-HTML-FILE> -name "*.htm*"); do |
7 |
~ tmp=$(mktemp); |
8 |
|
9 |
~ sed 's/VV, ppp-ppp/81, 51-67/' $x > $tmp && mv $tmp $x; |
10 |
|
11 |
~ rm $tmp; |
12 |
done |
13 |
|
14 |
Matthew R. Lee schrieb: |
15 |
| I have a folder full of .html files and I need to go through and replace in |
16 |
| each and every one of them a couple of bits of info. I know I can do this |
17 |
| using the following from the command line: |
18 |
| sed 's/VV, ppp-ppp/81, 51-67/' file.html > newfile.html | mv newfile.html |
19 |
| file.html |
20 |
| Problem is I need to do this on nearly 200 files. I assume it could be done |
21 |
| with a script, but I have zero experience in writing scripts. I've looked |
22 |
| through a few how-to's but haven't found anything I understand sofar. I want |
23 |
| to learn how to script, but my Prof want's this done yesterday as the |
24 |
| associated paper has just been published. |
25 |
| Cheers |
26 |
| Matt |
27 |
|
28 |
- -- |
29 |
Johann Schmitz |
30 |
http://www.j-schmitz.net |
31 |
|
32 |
-----BEGIN PGP SIGNATURE----- |
33 |
Version: GnuPG v2.0.9 (GNU/Linux) |
34 |
|
35 |
iEYEARECAAYFAkgYl40ACgkQZsUt7MqpQk0B4ACfdSv5T9h3kd45vseh3vKg5vun |
36 |
ga4AoKL6nnAiobGsWIwHgND7DChxUNy6 |
37 |
=ESvU |
38 |
-----END PGP SIGNATURE----- |
39 |
-- |
40 |
gentoo-user@l.g.o mailing list |