Updated : Thanks for your answers. As I said, my q was just a translation of my usecase. Let me get into more details of what I want to achieve. In my dev env, we use "ade" as our version control system what I want to do is :
ade describetrans | awk '/myapps/{ print $2 }' | sort -fr | xargs -iF ade unbranch F
Now, every single time I run the unbranch command, a new file/dir gets checked out. so I need to run ade checkin -all after all my unbranch commands. So I needed something like
"pre part till sort" | xargs -iF (ade unbranch + ade checkin -all)
Any way to run 2 commands on the op of pipe ?
Thanks
Original question asked :
I can translate the usecase I have into the following :
I need to get the 1st line of a file. I do
cat file | head -1
Now I want to do this on a list of files. How do I do the following in one unix command ?? Eg :
find . -name "*.log" | ( xargs -iF cat F | head -1 )
Obviously the brackets in the above command do not work.
is there a way to pipe the output of the find command and do 2 commands on it ( cat and head ) ? Tried using ; and && but dint help. I can create a script - but wanted to do this in one command.
Again - this is just a translation of the case I have.
thanks Rohan