This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I want to change all the text files in one directory which contains the string "John" to "Peter" using some unix script. (because there are >100 and i can't vi every file and change it) sample1.txt John 10 Mary 20 Mat 50 sample2.txt John 10 Jeff 40 Mat 50 to sample1.txt Peter 10 Mary 20 Mat 50 sample2.txt Peter 10 Jeff 40 Mat 50 in my unix directory. Are there a way to do it? Thanks so much for the script.
hi Stef, Thanks so much for the code. I think I don't need it for now. =) Because it's all in one flatten directory Sorry that I was new to the UNIX, so should i create a script in the same directory and call it something like mytest.sh ?
Joined: Apr 18, 2002
hi Stef, I put that into script.sh chmod and ran it by ./script.sh
Any clue that why am having this error? FILES=`grep -l John *`: Ambiguous FILES: Undefined variable thanks!