MrRockchip

Recursively: Find files / Replace string ;-)

Feb 13th, 2013 (edited)
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.37 KB | None | 0 0
  1. Find files with string and write results of search to text file: ()
  2.  
  3. find . -name "*" | xargs grep -i -n "string1" >> ./../results.txt
  4.  
  5. Replace string in files with another string:
  6.  
  7. 1) "/" separators:
  8. find ./ -name "*" | xargs sed -i 's/string1/string2/'
  9.  
  10. 2) "," separators:
  11. find ./ -name "*" | xargs sed -i 's,string1(with / characters),string2(with / characters),'
Add Comment
Please, Sign In to add comment