bash - How to use NULL (\0) as the delimiter in GNU sort -
i looking way sort results of find returning number of directories correctly further processing in bash script. since filenames can't contain null (\0) character thought make great delimiter results being piped sort.
so expect work described:
find ./ -maxdepth 1 -type d -iname 'xyz?' -print0 | sort -t $'\0' but sadly got compaint sort: empty tab
looking around explanation came across question leading similar result op described working fine (see lucas comment of apr 26th). in case (using gnu sort v 7.4) seems different.
i checked output of find piping od -c shows resulting folders separated null expected.
has here come across similar scenario , possibly found solution or explanation why \0 seem impossible delimiter sort?
looking forward answers...
edit: note find-command used example here, simpler way test/illustrate echo "g\0u\0b\0k" | sort -t $'\0'
-t field separator. if want use \0 line separator need use -z.
Comments
Post a Comment