How to 'cut' on null? How to 'cut' on null? unix unix

How to 'cut' on null?


Just specify an empty delimiter:

cut -d '' -f1

(N.B.: The space between the -d and the '' is important, so that the -d and the empty string get passed as separate arguments; if you write -d'', then that will get passed as just -d, and then cut will think you're trying to use -f1 as the delimiter, which it will complain about, with an error message that "the delimiter must be a single character".)