开发者

unix - how to deal with too many args for cat

开发者 https://www.devze.com 2022-12-28 23:43 出处:网络
I have a bunch of files in a directory, each with one line of text. I want to cat all of these files together (all the one liners) into a single, large file. However, when I use cat there开发者_C百科

I have a bunch of files in a directory, each with one line of text. I want to cat all of these files together (all the one liners) into a single, large file. However, when I use cat there开发者_C百科 are too many arguments. How can I get around this?


bash$ (ls | xargs cat) > /tmp/some_big_file


try to use -n with xargs to reduce the number of arguments passed to cat

find .|xargs -n 100 cat >> out


look into xargs

find . <whatever> | xargs cat > outfile.txt

Replace the find . <whatever> bit with your own way of getting all the files

Replace outfile.txt with your output file.

0

精彩评论

暂无评论...
验证码 换一张
取 消