Sample Header Ad - 728x90

Unexpected cut output

0 votes
2 answers
68 views
I am getting an unexpected output from cut. I would expect no output since there is no third field based on the specified delimiter. The first two lines intentionally use commas as delimiters, and the third uses both commas and semicolons. I know how cut generally works, but I was trying to show that this shouldn't produce output in this example but it is. input file: students.txt
Fred,Jones,sophomore
Mary,Adams,freshman
Sam,Fredrick;senior
cut command:
cut -f3 -d ';' students.txt
unexpected output:
Fred,Jones,sophomore
Mary,Adams,freshman
Asked by ayeieye (1 rep)
Jan 26, 2024, 08:51 PM
Last activity: Jan 26, 2024, 09:21 PM