Reputation: 3
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.
Upvotes: 0
Views: 64
Reputation:
It should work with the pipe.
awk -F "," '{print $1, $5}' < Task.txt | sed '/^\s*$/d' > Task_mod.txt
EDIT:
Upvotes: 1
Reputation: 3089
You can do this in single command itself :
awk -F "," 'NF>1 {print $1, $5}' Task.txt > Task_mod.txt
Upvotes: 1