> 覆盖写入
>> append模式写入
###################################################################
合并数据库文件:
Windows 中实现合并多个文件内容到一个文件中
代码如下 复制代码
copy *.sql MERGE.sql
Linux 或 类Unix 下实现合并多个文件内容到一个文件中
代码如下 复制代码
cat b1.sql b2.sql b3.sql > b_all.sql
或者
cat *.sql > merge.sql
---------------------
https://www.runoob.com/linux/linux-comm-cat.html
cat的作用:
Linux shell命令之cat
cat:查看文件的内容、连接文件、创建一个或多个文件和重定向输出到终端或文件 用法:cat [选项] [文件]
1. $ cat hello.txt
显示hello.txt文本文件中的内容
2. $ cat -n file
-n选项,可以显示文件的内容和行号
3. $ cat -b file
-b选项,与-n类似,但只标识非空白行的行号(空白行仍显示)
4. $ cat -e file
-e选项,将在每一行的末尾显示“$”字符,在需要将多行内容转换成一行时非常有用。
5. $ cat
只输入cat命令的话,它只是接收标准输入的内容并在标准输出中显示,所以在输入一行并按回车后会在接下来的一行显示相同的内容。
如:$ cat
hello world!
hello world!
$
重定向的话:
$ cat >hello
hello world!
(ctrl+D组合键退出,输入的内容 hello world! 会写入到文件hello中)
$ cat hello
hello world!
$
重定向操作符有两个: >和>>,前者是内容覆盖,后者是在文件的最后追加。
6. 连接多个文件的内容到一个新文件
$ cat test test1 > test2
$ cat test2
结果将显示test和test1中的内容。