Usage of '-' after pipe
I saw this line of code the other day and I didn't know exactly what is this - or when to use it. This is a simple code and from what I understood is that - takes the piped output and treats it as an argument of paste (correct me if I'am wrong)
seq $size | paste - $file
My question is when can we use this and is there another way to do the same thing? Thanks,
This is documented in the man page for
With no FILE, or when FILE is -, read standard input.
pasteexpects you to give it a filename, but you can instead give it a single
-instead, which paste will interpret as it should read data from
stdin, your pipe in this case, instead of opening a file and read data from that file.