bash: how do I concatenate the output of two commands so that I can pipe them to a third? bash: how do I concatenate the output of two commands so that I can pipe them to a third? bash bash

bash: how do I concatenate the output of two commands so that I can pipe them to a third?


Use curly braces to group commands:

$ { echo first line; echo second line; } | grep "line"first linesecond line

(Posted as an answer from camh's comment)


You can use a subshell:

( hg status; hg status --ignored ) | awk '( $1 == "?" ) || ( $1 == "I") { print $2 }' | xargs rm -r


You can use the rest of the hg status flags to show what you really want:

hg status -uriamn

That shows unknown files (u), removed files (r), ignored (i), added (a), modified (m) and does so without showing the status prefix.