Leila Bose Leila Bose - 3 years ago 176
Linux Question

Combine two commands in linux and append it to another file

awk -F "," '{print $1, $5}' < Task.txt > Task_mod.txt //this works fine

sed '/^\s*$/d' //this removes the blank lines

I am trying to put these commands together in linux and append it to Task_mod. Any ideas on how to put it together? It doesn't work with the pipe command.

Answer Source

It should work with the pipe.

awk -F "," '{print $1, $5}' < Task.txt | sed '/^\s*$/d'  > Task_mod.txt


  • If you want to append you need to use >> instead of >
  • What errors do you see when you run it with the pipe? I did it and I think it works...
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download