Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
if i have a bunch of pages loading bogus information and i need to change one number from 150 to 100....how do i find and replace in all the files the correct number. is awk my best bet? i've never used it. what is the best way to pipe grep into a awk command. preferable only "*.php" files?
only reason i thought i might need to use grep is b/c i've got many php files in multiple directories that need numbers changed in them. so i'm trying to come up with a nice command to switch "word1" with "word2".....
A couple of years ago I took a Unix class where we were briefly introduced to awk and sed. One of these days I need to go back and try to remember how to awk, sed, grep, fgrep, egrep, pipes and regular expressions. I only use Linux on my home computer and so far have not bothered to use those tools.
which ever works....which ever lets me edit "word1" for "word2"...i'm like Rick485 i never bothered to learn awk or sed though i have used somewhat simple greps and finds. if someone knows i nice little pipped command to exchange/edit mulitple files in multiple directories...i would appreciate. as i contunie my search.....thnx guys...
b/c at the moment i can't seem to get it to work. my experience with sed is only replacing "word1" with "word2" when outputing to the screen. it isn't actually finding and replacing the word(s) in the actual file.
sed 's/ word1 / word2 /g' test
isn't working. help would be appreciated.
Last edited by wedgeworth; 02-18-2004 at 03:55 PM.
thanks for the little bit of code. i ended up doing a few greps that redirected to a data file that i read from a did a simple
sed 's/word1/word2/g' $file1 > test99
cat test99 > $file1
commands. i think i already had this running before you shot me over your commands. i held onto it but haven't tried it out yet. plus i'm only running sed version 3.02 on this computer. but thanks for the help though. hopefully when i get my server updated on some newer versions it'll come in handy. thnx....