Advertisement
Guest User

Untitled

a guest
May 2nd, 2012
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. Perl match newline in `-0` mode
  2. I've got a loverly bunch of coconut trees.
  3.  
  4. Newlines!
  5.  
  6. Bahahaha
  7. Newlines!
  8. the end.
  9.  
  10. I've got a loverly bunch of coconut trees.
  11.  
  12. NEWLINES!
  13.  
  14. Bahahaha
  15. Newlines!
  16. the end.
  17.  
  18. perl -p -e 's@Newlines!@NEWLINES!@g' input.txt
  19.  
  20. perl -p -e 's@nNewlines!n@nNEWLINES!n@g' input.txt
  21.  
  22. perl -p -e 's@(?<=n)Newlines!(?=n)@NEWLINES!@g' input.txt
  23.  
  24. perl -0p -e 's@(?<=n)Newlines!(?=n)@NEWLINES!@g' input.txt
  25.  
  26. perl -0p -e 's@(?<=)Newlines!(?=)@NEWLINES!@g' input.txt
  27.  
  28. perl -0pe 's@(?<=nn)Newlines!(?=nn)@NEWLINES!@g'
  29.  
  30. perl -0p -i.bk -e 's/nnNewlines!nn/nnNEWLINES!nn/g' input.txt
  31.  
  32. perl -0777 -pe 's/nnNewlines!(?=nn)/nnNEWLINES!/g'
  33.  
  34. perl -ne 'push @buffer, $_; $buffer[1] = "NEWLINES!n" if @buffer == 3 && '
  35. -e 'join("", @buffer) eq "nNewlines!nn"; '
  36. -e 'print shift @buffer if @buffer == 3; END { print @buffer }'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement