On Solaris, what is the difference between cut and gcut?

Posted by Chris J on Stack Overflow See other posts from Stack Overflow or by Chris J
Published on 2010-02-04T15:15:26Z Indexed on 2010/04/08 11:03 UTC
Read the original article Hit count: 221

Filed under:
|

I recently came across this crazy script bug on one of my Solaris machines. I found that cut on Solaris skips lines from the files that it processes (or at least very large ones - 800 MB in my case).

> cut -f 1 test.tsv | wc -l
  457030
> gcut -f 1 test.tsv | wc -l
  840571
> cut -f 1 test.tsv > temp_cut_1.txt
> gcut -f 1 test.tsv > temp_gcut_1.txt
> diff temp_cut_1.txt temp_gcut_1.txt | grep '[<]' | wc -l
       0

My question is what the hell is going on with Solaris cut? My solution is updating my scripts to use gcut but... what the hell?

© Stack Overflow or respective owner

Related posts about solaris

Related posts about shell-scripting