Search code examples
cut

No difference in output running 'cut -f 1 sample.txt'


echo 'The quick brown; fox jumps over the lazy dog' > sample.txt

I then run

cut -f 1 sample.txt

or

cut -f 2 sample.txt

and my output is always the same,

The quick brown; fox jumps; over the lazy dog;

should't the output of the first 'cut' command be 'dog'? Why is the output the same if I run each 'cut' command?


Solution

  • the default separator is tab, if you want space instead set it with -d (delimeter)

    cut -f 1 -d ' ' sample.txt
    The
    

    https://en.wikibooks.org/wiki/Cut