Here is an example of using
cut to break input into fields using a space delimiter, and obtaining the second field:
cut -f2 -d' '
How can the delimiter be defined as a tab, instead of a space?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
Press Ctrl+V and then Tab to use "verbatim" quoted insert.
cut -f2 -d' ' infile
or write it like this to use ANSI-C quoting:
cut -f2 -d$'\t' infile
$'...' form of quotes isn't part of the POSIX shell language (not yet), but works at least in ksh, mksh, zsh and Busybox in addition to Bash.
Tab is the default.
See the cut man page.
-d delim Use delim as the field delimiter character instead of the tab character.
So you should just write
cut -f 2