如下所示,文件hello.txt中有5行数据,要将这5行数据在一行中显示出来,并用空格分隔。
jie$ cat hello.txt
1
2
3
4
5
从下方法均可实现:
方法1.
$ echo `cat hello.txt`
1 2 3 4 5
cat hello.txt | xargs
1 2 3 4 5
$a=$(cat hello.txt)
cat "$a"
1
2
3
4
5
原文:https://blog.csdn.net/guoyajie1990/article/details/73692526
jie$ cat hello.txt
1
2
3
4
5
从下方法均可实现:
方法1.
$ echo `cat hello.txt`
1 2 3 4 5
cat hello.txt | xargs
1 2 3 4 5
$a=$(cat hello.txt)
cat "$a"
1
2
3
4
5
原文:https://blog.csdn.net/guoyajie1990/article/details/73692526
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:http://jackxiang.com/post/10173/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
最后编辑: jackxiang 编辑于2019-4-18 16:18
评论列表