by vsbuffalo on 3/11/15, 7:38 AM with 96 comments
by aidos on 3/11/15, 9:46 AM
I only discovered process substitution a few months ago but it's already become a frequently used tool in my kit.
One thing that I find a little annoying about unix commands sometimes is how hard it can be to google for them. '<()', nope, "command as file argument to other command unix," nope. The first couple of times I tried to use it, I knew it existed but struggled to find any documentation. "Damnit, I know it's something like that, how does it work again?..."
Unless you know to look for "Process Substitution" it can be hard to find information on these things. And that's once you even know these things exist....
Anyone know a good resource I should be using when I find myself in a situation like that?
by unhammer on 3/11/15, 10:22 AM
# avoid temporary files when some program needs two inputs:
join -e0 -o0,1.1,2.1 -a1 -a2 -j2 -t$'\t' \
<(sort -k2,2 -t$'\t' freq/forms.${lang}) \
<(sort -k2,2 -t$'\t' freq/lms.${lang})
# gawk doesn't care if it's given a regular file or the output fd of some process:
gawk -v dict=<(munge_dict) -f compound_translate.awk <in.txt
# prepend a header:
cat <(echo -e "${word}\t% ${lang}\tsum" | tr [:lower:] [:upper:]) \
<(coverage ${lang})
by larsf on 3/11/15, 12:31 PM
And my company creates a cool dataflow platform - https://composableanalytics.com
by Malarkey73 on 3/11/15, 9:18 AM
Or even if you think you know unix/bash and data there are new and unexpected snippets every few pages that surprise you.
by dbbolton on 3/11/15, 5:34 PM
paste <(cut -f1 file1) <(cut -f3 file2) | tee >(process1) >(process2) >/dev/null
can be re-written as: paste <(cut -f1 file1) <(cut -f3 file2) > >(process1) > >(process2)
http://zsh.sourceforge.net/Doc/Release/Expansion.html#Proces...http://zsh.sourceforge.net/Doc/Release/Redirection.html#Redi...
by amelius on 3/11/15, 10:06 AM
by baschism on 3/11/15, 12:34 PM
by mhax on 3/11/15, 9:34 AM
by anateus on 3/11/15, 6:43 PM
diff (sort a.txt|psub) (sort b.txt|psub)
The psub command performs the process substitution.by AndrewSB on 3/11/15, 10:52 AM
by frankerz on 3/11/15, 9:45 AM
For example (from Wikipedia)
tee >(wc -l >&2) < bigfile | gzip > bigfile.gz
vs
tee < bigfile | wc -l | gzip > bigfile.gz
by chuckcode on 3/11/15, 4:20 PM
by jamesrom on 3/11/15, 1:24 PM
Can't be sure if he is a bioinformatician because he never really mentions that he is a bioinformatician.
by leni536 on 3/11/15, 2:37 PM
pee: tee standard input to pipes sponge: soak up standard input and write to a file ts: timestamp standard input vipe: insert a text editor into a pipe
by hitlin37 on 3/11/15, 10:48 AM
by Dewie on 3/11/15, 10:39 AM