开发者

How to build one file contains other files, selected by mask?

I need开发者_如何学JAVA to put the contents of all *.as files in some specified folder into one big file.

How can I do it in Linux shell?


You mean cat *.as > onebigfile?


If you need all files in all subdirectories, th most robust way to do this is:

rm onebigfile
find -name '*.as' -print0 | xargs -0 cat >> onebigfile

This:

  • deletes onebigfile
  • for each file found, appends it onto onebigfile (this is why we delete it in the previous step -- otherwise you could end up tacking onto some existing file.)

A less robust but simpler solution:

cat `find -name '*.as'` > onebigfile

(The latter version doesn't handle very large numbers of files or files with weird filenames so well.)


Not sure what you mean by compile but are you looking for tar?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜