Possible Duplicate:
Shell programming, avoiding tempfiles
Say I have the file data.txt, and the command cmd.
cmd takes one argument, a file. Or, you could use stdin.
Now, say data.txt is uppercase, but cmd only works if all data is lowercase.
Sure, you could do this
tr '[:upper:]' '[:lower:]' < data.txt > lowercase_data.txt
cmd lowercase_data.txt
rm lowercase_data.txt
But, is there a way to integrate this?
Like, a wrapper around the original file, that applies a filter, then passes a reference to the temporary file; the command is executed; last, the temporary file is deleted?
I use zsh.
bashuser I'm not itimately familiar withzsh, but it appears to support process substitution: possiblycmd =(tr '[:upper:]' '[:lower:]' < data.txt)would do it, but I'll let someone morezshsavvy followup. – Reed Kraft-Murphy Feb 04 '13 at 00:37<data.txt tr ... | cmd? – Kevin Feb 04 '13 at 03:14