How to use NULL (\0) as the delimiter in GNU sort

前端 未结 3 1112
轻奢々
轻奢々 2021-02-19 04:16

i am looking for a way to sort the results of find returning a number of directories correctly for further processing in a bash script. since filenames can\'t conta

3条回答
  •  情深已故
    2021-02-19 05:01

    Use the -z option to sort zero-terminated data sets:

    find ./ -maxdepth 1 -type d -iname 'xyz?' -print0 | sort -z | tr '\0' '\n'
    

提交回复
热议问题