linux合文件
2024-02-15 17:12:16
```bash
cat filetxt filetxt > combined.txt
```
这个命令会将filetxt和filetxt的内容合保存到combined.txt中。
```bash
echo $(cat filetxt) $(cat filetxt) > combined.txt
```
这个命令是将两个文件的内容合保存到combined.txt中,但是它使用cat命令获取每个文件的内容,用echo命令打印这些内容。
```bash
sed -e 'r filetxt' -e 'i filetxt' > combined.txt
```
这个命令会在combined.txt的开头添加filetxt的内容,而在结尾添加filetxt的内容。
```bash
awk 'FNR==NR{a[NR]=$;next}{print $,a[FNR]}' filetxt filetxt > combined.txt
```
这个命令会先读取filetxt的所有行将它们保存在个数组中,读取filetxt中的每行在其后面添加array中对行的内容。