sed cheat sheet, feed command line by line to other command
S-command - Extract part of string
sed -n -r "s/(<string to search for>)/\\1/p" -n = Do not print, without this the command will output everything but replace the search string with the replacement. -r = Use extended regular expressions p = Print what is matched \1 = Output string between first set of parentheses ( ... ). [[:space:]] is used instead of \s for spaces.
Feed output of one command line by line to another
This feeds the output of a command to echo: command| while IFS= read -r line; do echo $line; done; -r = Do not treat and remove backslashes IFS= = Do not truncate beginning of lines Source: https://unix.stackexchange.com/questions/18886/why-is-while-ifs-read-used-so-often-instead-of-ifs-while-read/18936#18936
This is a personal note. Last updated: 2022-11-21 15:30:33.