How can I use the output of sed in another script?For example (this doesn't work):sed -n $COUNTER,1p /domains.csv | wgetor sed -n $COUNTER,1p /domains.csv > /myScript.shAs far as I know > lets me take the output and put it in a file, I'm just unsure of how to use this output as an argument in another script.(I am aware I can declare the output as a variable, and then use it on the next line. I'm interested in how to do this as one command)
Using sed output in another script or command
bash;shell;sed;arguments;output
The | takes output and redirects it into stdin. wget needs a command line argument, not stdin so you want to pipe to xargs which will build a command line from stdin.sed -n $COUNTER,1p /domains.csv | xargs wgetAlternatively you can tell wget to take input on stdinsed -n $COUNTER,1p /domains.csv | wget -i -