lkml.org 
[lkml]   [2008]   [Apr]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: tee question [OT]

On Sunday 2008-04-06 06:30, Jan Engelhardt wrote:
> On Sunday 2008-04-06 06:10, Marc Perkel wrote:
>>
>> echo "1 2 3 4 5" | tee ...
>> | cut -d \ -f -4 >> file1.txt
>> | cut -d \ -f 1,2,5- >> file2.txt
>>
>> The idea being that file1.txt would get "1 2 3 4" and
>> file2.txt would get "1 2 5"
>>
>> How do I do it? Tee wants a file as an argument and I
>> want that file to be a process.
>> Anyhow - I'm not very smart.
>
> echo "1 2 3 4 5" | \
> tee > (cut -d" " -f -4 >>file1.txt) |
> tee > (cut something else >>topieces) |
> cut -d" " -f 1,2,5- >>file2.txt;
>

Everything can be a process, and in almost arbitrary order ... :-)

tee >(cut >file2.txt -d" " -f 1,2,5-) < <(tee >(cut >file1.txt -d" " -f -4) < <(echo "1 2 3 4 5")) >/dev/null


\
 
 \ /
  Last update: 2008-04-06 06:41    [W:0.035 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site