diff --git a/cheat/cheatsheets/perl b/cheat/cheatsheets/perl new file mode 100644 index 0000000..bd7edc7 --- /dev/null +++ b/cheat/cheatsheets/perl @@ -0,0 +1,8 @@ +# To view the perl version: +perl -v + +# Replace string "\n" to newline +echo -e "foo\nbar\nbaz" | perl -pe 's/\n/\\n/g;' + +# Replace newline with multiple line to space +cat test.txt | perl -0pe "s/test1\ntest2/test1 test2/m"