Advertisement
Guest User

Untitled

a guest
Apr 27th, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #####replace string in a file #####
  2. sed -i 's/original/new/g' file.txt
  3.  
  4. Explanation:
  5. sed = Stream EDitor
  6. -i = in-place (i.e. save back to the original file)
  7. The command string:
  8. s = the substitute command
  9. original = a regular expression describing the word to replace (or just the word itself)
  10. new = the text to replace it with
  11. g = global (i.e. replace all and not just the first occurrence)
  12. file.txt = the file name
  13. #####replace string in a file #####
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement