Thursday, February 12, 2015

Unix interview question - Cut command

1) How to take first 3 fields from tab delimited(tsv) file?

cut -f 1-3 /dev/stdin

2) Print characters from nth position to last.

cut -cn- /dev/stdin

Here n stands for position.

3) Display nth word in a line
cut -d' ' -f4 /dev/stdin

No comments:

Post a Comment