Cheatsheet sed :
- sed ‘s/word/replace/’ file , or file | sed ‘s/word/replace/’ , or sed ‘s.word.replace.’
- sed ‘s/word/replace/g’ (/g replace everything).
- sed ‘s/word//g’ or sed ‘s/word//g’ (delete “word”).
- sed “s/#.*//g” file ( “#.*” any word after #, “//g” replace”).
- sed “s/\s*#.*//g” file (“\s” was whitespace, “\s*” = * was any word).
- sed “s/\s*#.*//g;/UwU/d” file (“/d” was delete).
- sed “s/\s*#.*//g;/UwU/p” file (“/p” was print).
- sed “s/\s*#.*//g;/UwU/p” file (“;” was delimiter).
- sed “s/\s*#.*//g;/UwU/q” file (“/q” was quit, “/UwU/q” quit after find “UwU”).
- sed “s/\s*#.*//g;3/q” file (“69/q” was quit after reach line 69).
Cheatsheet Grep :
- grep “i.u” (“.” any char (1 char)).
- grep “i*u” (“*” match prev number, inc 0 (≥ 0)).
- grep “i\+u” (“\+” match prev number, exc 0 (>0)).
- grep “e$” (“e$” word end with “e”).
- grep “^g” (“^g” word start with “g”).