Rob Dixon wrote:
If you think the one-liner is non-trivial then all the more reason that you
should use a proper script. It is a bad idea to use any code unless you
understand why and how it works.
The script isn't trivial (to me) either. Incidentally the same can be done in
sed one-liner.
se
Thomas Bätzler wrote:
perl -i -ple '$_ = "cc\n$_" if $p =~ m/aa/ && m/bb/; $p=$_'
Thanks. looks non-trivial for me. Anyway I will copy this idiom into my cheat
sheet.
Thank Gunnar for suggestion too. However I prefer one-liner.
regard,
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additi
Hello,
Sorry this must be a faq but I cannot find any answer in google.
Suppose I want to change 2 lines to 3 line in files as follow using perl -p -i
-e command
aa
bb
aa
cc
bb
this doesn't work
perl -p -i -e "s/aa\nbb/aa\ncc\nbb/g;" foo.txt
what is the correct command (I use linux).
Thanks