cut¶
cut parts of lines from specified files or piped data and print the result to standard output.
basic options¶
-f(--fields): 1,3 [select 1 and 3]; -4 [select 1 to 4]-c(--characters): -c4- [select from 4th character to end]-b(--bytes): -b1 [select 1st byte]
other options¶
-ddelimiter specified instead of default “TAB”--output-delimiterspecify output delimiter, default to input delimiter-s(--only-delimited) not print lines without delimiters--complementexclude selected
get second field¶
get field based on delimiter¶
Select field 4
Delimiter has multiple spaces
usetr command along with squeeze option (-s flag ) to convert all multiple consecutive spaces to a single space.