Oebele

My Sed Command

Dec 5th, 2013
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.15 KB | None | 0 0
  1. # to switch all X's after an occurence of ': ' into Y's
  2. sed -n '
  3. h
  4. s|\(.*: \).*|\1|
  5. x
  6. s|.*: \(.*\)|\1|
  7. s|X|Y|g
  8. H
  9. x
  10. s|: \n|: |
  11. p
  12. ' < the_file
Advertisement
Add Comment
Please, Sign In to add comment