Advertisement
Guest User

Untitled

a guest
Aug 31st, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. function sar () {
  2. from="$1"
  3. shift
  4. to="$1"
  5. shift
  6.  
  7. if [[ $from == '' || $to == '' ]]
  8. then
  9. echo Usage: sar <from> <to> <filename>
  10. return
  11. fi
  12.  
  13. while [[ $# -gt 0 ]]
  14. do
  15. filename="$1"
  16. shift
  17. find ./$filename -type f -exec sed -i -e 's/$from/$to/g' {} ;
  18. done
  19. }
  20.  
  21. $ sar xxxx yyyy mydir
  22.  
  23. + find ./mydir -type f -exec sed -i -e 's/$from/$to/g' '{}' ';'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement