unix - How to use cut and paste together in one go -
i trying use cut , paste in same command line somehow not work. have 2 files, filea , fileb.
filea b c d fileb 1 2 3 4 5 6 7 8 i cut second , third column of fileb. following command.
cut -f 2-3 fileb then in front of this, paste columns filea
paste filea | cut -f 2-3 fileb > mynewfile so mynewfile like
a b 2 3 c d 6 7 i can in 2 lines.
cut -f 2-3 fileb > part1 paste filea part1 > mynewfile but instead, in 1 go. similar to
paste filea | cut -f 2-3 fileb > mynewfile which not work. prints cut commands , not paste. how can make work in 1 command?
thanks.
solution 1:
paste filea <(cut -f 2-3 fileb) > mynewfile solution 2:
paste filea fileb | cut -f1-2,4-5
Comments
Post a Comment