Bash命令将多个文件的内容写入单个文件 [英] Bash command to write the contents of multiple files into a single file

查看:81
本文介绍了Bash命令将多个文件的内容写入单个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道将多个.html文件(分布在多个文件夹中)合并为一个html文件的最佳方法是什么.如果有人可以创建一个简单的bash命令,那就太好了. (这是一种解决方法,因此我可以使用firebug的命令行API有效地在整个网站上搜索html选择器组合.据我所知,firebug只能在一页上进行搜索.)

I'm wondering what's the best way to combine multiple .html files (spread across many folders) into one single html file. If someone could create a simple bash command that would be fantastic. (This is a workaround so I can use firebug's command line API to effectively search an entire site for html selector combinations. As far as I know, firebug can only search on one page.)

对于这个受困的前端设计师,任何帮助都将不胜感激.

Any help is greatly appreciated for this stymied front-end designer.

推荐答案

cat file1.html file2.html file3.html > newfile.html


编辑 这可能更容易


Edit This may be easier

find . -name="*.html" | xargs cat >> ../newfile.html

请注意,newfile.html是从当前目录上推的,因此不会被其自身容纳.

Note that newfile.html is pushed up from the current directory so it is not cat'ed into itself.

这篇关于Bash命令将多个文件的内容写入单个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆