Wednesday, 7 August 2013

linux get filecontent as stdio after pipe

linux get filecontent as stdio after pipe

I have an linux command that reads stdio and generates a simple file per
hour:
myapp > ~/$( date "+%Y%m%d%H.txt" )
Then, because myapp can read from stdio clear text files and my input
files are zipped, i use zcat to read files and send them to previous
processing:
zcat myfile.zip | myapp > ~/$( date "+%Y%m%d%H.txt" )
so far, everything is fine. the problem is that i need to read that
variable-name file and continue to process it, eg, to send the file
content to 'head' command. i try:
head $( zcat myfile.zip | myapp > ~/$( date "+%Y%m%d%H.txt" ) )
without sucess. and i really don't want to create another variable because
this process can take more than 1h to go.. and maybe i will get a diferent
filename variable in head:
zcat myfile.zip | myapp > ~/$( date "+%Y%m%d%H.txt" ) ) && head ~/$( date
"+%Y%m%d%H.txt" )
So, what do you think is the best way to do this?
thanks all.

No comments:

Post a Comment