Advertisement
Guest User

find sed

a guest
Nov 26th, 2014
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. # Trying to find all .txt files in a deep directory and replacing
  2. # specific occurrences of spaces and tabs with a single space.
  3. # f.ex. replacing "aa bb" with "aa bb".
  4.  
  5. # This works:
  6. find my_dir -iname "*.txt"
  7.  
  8. # This works:
  9. sed -E -i '' $'s/aa[ \t]+bb/aa bb/g' file.txt
  10.  
  11. # Together, they do not work:
  12. find my_dir -iname "*.txt" -exec sed -E -i '' $'s/aa[ \t]+bb/aa bb/g' {} +
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement