From 0b0bc441c6932926fff9a31944eadcfa2e04100a Mon Sep 17 00:00:00 2001 From: Michihito Shigemura Date: Mon, 20 Nov 2017 21:20:22 +0900 Subject: [PATCH] Add cheatsheet perl --- cheat/cheatsheets/perl | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 cheat/cheatsheets/perl 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"