cat <(echo brew install) <(brew list) | sed ':a;N;$!ba;s/\n/ /g' > brew_install.txt
It lists directly from brew, prepends brew install and then replaces all newlines with a space and outputs to brew_install.txt
cat <(echo brew install) <(brew list) | sed ':a;N;$!ba;s/\n/ /g' > brew_install.txt
It lists directly from brew, prepends brew install and then replaces all newlines with a space and outputs to brew_install.txt