home.


Tagged: unix-cut


Unix commands: cut and paste

cat textfile | cut -d$'\t' -f1

This will separate fields in textfile by a tab character, and display only the first field. (Only works in bash, not plain sh, due to $‘\t’ I believe)

cat textfile | paste -s --delimiters=','

This will join all the lines in a text file (-s) using the delimiter ‘,’.

unix unix-cut unix-paste

Page 1 of 1