in reply to How to inject chr(10) chr(13) into a string
With binmode, what you have would work.
perl -i.bak -pe "BEGIN { binmode STDOUT } s/(?=\[)/\r\n/g" file
Without binmode, \n gets transformed to CR+LF, so \r\n become CR+CR+LF.
perl -i.bak -pe "s/(?=\[)/\n/g" file
Update: Escaped [ as noticed by Tanktalus.
|
|---|