Advertisement
homer512

dup mod sed

May 14th, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.37 KB | None | 0 0
  1. #!/bin/sed -f
  2.  
  3. # see http://theunixshell.blogspot.de/2014/05/inserting-lines-in-file-using-perl.html
  4.  
  5. # write line unchanged
  6. p
  7. # change to hold space
  8. x
  9. # initialize replacement sequence if it wasn't already
  10. s/^$/5\"/
  11. # append to original line
  12. H
  13. # cycle through numbers for next iteration
  14. y/567/675/
  15. # change to appended line
  16. x
  17. # remove old line end
  18. s/.\"\n//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement