From 3b0142cedcde39e4c2097ecd916a870a3ced5ec6 Mon Sep 17 00:00:00 2001 From: Vito Graffagnino Date: Tue, 8 Sep 2020 18:10:49 +0100 Subject: Added the relevent parts of the .config directory. Alss add ssh config --- .cheat/cheat/sed | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .cheat/cheat/sed (limited to '.cheat/cheat/sed') diff --git a/.cheat/cheat/sed b/.cheat/cheat/sed new file mode 100644 index 0000000..e22c97a --- /dev/null +++ b/.cheat/cheat/sed @@ -0,0 +1,17 @@ +# To replace all occurrences of "day" with "night" and write to stdout: +sed 's/day/night/g' file.txt + +# To replace all occurrences of "day" with "night" within file.txt: +sed -i 's/day/night/g' file.txt + +# To replace all occurrences of "day" with "night" on stdin: +echo 'It is daytime' | sed 's/day/night/g' + +# To remove leading spaces +sed -i -r 's/^\s+//g' file.txt + +# To remove empty lines and print results to stdout: +sed '/^$/d' file.txt + +# To replace newlines in multiple lines +sed ':a;N;$!ba;s/\n//g' file.txt -- cgit v1.2.3