Join all files in a directory

后端 未结 4 988
无人共我
无人共我 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:40

    use awk, say you want to join on 1st field

    awk '{a[$1]=a[$1] FS $0}END{for(i in a) print i,a[i]}' file*
    

提交回复
热议问题