Skip to main content
added 332 characters in body
Source Link
Barmar
  • 10.6k
  • 1
  • 22
  • 29

Many programs allow - to be used as a filename to represent standard input or output (depending on whether it's an input or output file). So you can try piping to csvgrep and using -f -.

cat list1.txt list2.txt | csvgrep -f - -c 2 myfile.csv

If it works, it has an advantage over the process substitition method because it doesn't depend on a shell-specific extension.

If that doesn't work, you could use /dev/stdin. This is a standard Linux device that automatically refers to the process's standard input.

Note that all these solutions depend on csvgrep not needing to seek in the -f file, because the output of cat is being sent through a pipe. But this seems like a safe assumption.

Many programs allow - to be used as a filename to represent standard input or output (depending on whether it's an input or output file). So you can try piping to csvgrep and using -f -.

cat list1.txt list2.txt | csvgrep -f - -c 2 myfile.csv

If it works, it has an advantage over the process substitition method because it doesn't depend on a shell-specific extension.

Many programs allow - to be used as a filename to represent standard input or output (depending on whether it's an input or output file). So you can try piping to csvgrep and using -f -.

cat list1.txt list2.txt | csvgrep -f - -c 2 myfile.csv

If it works, it has an advantage over the process substitition method because it doesn't depend on a shell-specific extension.

If that doesn't work, you could use /dev/stdin. This is a standard Linux device that automatically refers to the process's standard input.

Note that all these solutions depend on csvgrep not needing to seek in the -f file, because the output of cat is being sent through a pipe. But this seems like a safe assumption.

Source Link
Barmar
  • 10.6k
  • 1
  • 22
  • 29

Many programs allow - to be used as a filename to represent standard input or output (depending on whether it's an input or output file). So you can try piping to csvgrep and using -f -.

cat list1.txt list2.txt | csvgrep -f - -c 2 myfile.csv

If it works, it has an advantage over the process substitition method because it doesn't depend on a shell-specific extension.