Operating Systems > Linux and UNIX
Grep/File Searching question
LorKorub:
I am using Korn Shell. And I did a reverse-video on it right from the board.
I'll try it in bash...
LorKorub:
Bitchin'....
Thanks, dude....
How exactly did all of that work?
EDIT:
Calum....I've been on the man pages and Google all night trying to find a simple way to do this. I came up with the hypothesis that maybe you could use grep to find the line, pipe it to vi and use the Replace fucntion.....
...didn't work...LOL
[ October 03, 2002: Message edited by: LorKorub / BOB ]
Calum:
hey i hope i didn't sound condescending there, i haven't read the man pages, but these things you have both mentioned i think will have given me enough reading to sort out my own concern, so thanks to both of you! :D
flap:
for i in `find ./ -name '*.php'`;
...for each line returned by the command find ./ -name '*.php'...
do sed 's/height=200px//g' $i > tmp;
...do the following: use sed to find every occurrence of the string "height=200px" in the filename denoted by 'i' and replace it with a blank string. the > operator then redirects the output of this command (which would otherwise just be printed to stdout i.e. the screen) to the file 'tmp'
mv tmp $i; done
...overwrite the original unmodified file with the tmp file
In windows, incidentally, the procedure is:
1. Open file in notepad
2. Use the 'Replace' facility to remove all unwanted strings
3. Save file
Repeat 40 times
Calum:
and to specify a value to replace the original value? (for instance, to replace the line with "height=400px")
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version