Join all files in a directory

后端 未结 4 981
无人共我
无人共我 2021-01-15 05:51

How can I join all of the files in a directory. I can do it in one step by explicitly naming the files below, is there a way to do it without explicitly naming the files?

4条回答
  •  再見小時候
    2021-01-15 06:47

    #!/bin/bash
    
    data=
    for f in "${rpkmDir}"/HS*.chsn.rpkm
    do
      if [ ! "$data" ]
      then
        data="$(sort "$f")"
        continue
      fi
      data="$(join <(sort "$f") /dev/stdin <<< "$data")"
    done
    echo "$data"
    

提交回复
热议问题