linux cat 命令
来源:互联网 发布:c语言黑客代码大全 编辑:程序博客网 时间:2024/06/14 06:41
功能
连接文件或显示文件的内容语法
cat [选项] 文件选项
-n,--number 显示行号
-b,--number-nonblank 不显示空白行的行号
-s,--squeeze-blank 连续两个或以上的空白行替换成一个来显示
示例
cat a.txt显示文件的内容
lychie@ubuntu:/test$ cat a.txt
You laugh at me for being different,
but I laugh at you for being the same.
Don't go around saying the world owes you a living.
The world owes you nothing. It was here first.
You laugh at me for being different,
but I laugh at you for being the same.
Don't go around saying the world owes you a living.
The world owes you nothing. It was here first.
cat -n a.txt显示文件的内容
lychie@ubuntu:/test$ cat -n a.txt
1
2 You laugh at me for being different,
3
4 but I laugh at you for being the same.
5
6 Don't go around saying the world owes you a living.
7
8 The world owes you nothing. It was here first.
1
2 You laugh at me for being different,
3
4 but I laugh at you for being the same.
5
6 Don't go around saying the world owes you a living.
7
8 The world owes you nothing. It was here first.
cat -b a.txt显示文件的内容
lychie@ubuntu:/test$ cat -b a.txt
1 You laugh at me for being different,
2 but I laugh at you for being the same.
3 Don't go around saying the world owes you a living.
4 The world owes you nothing. It was here first.
1 You laugh at me for being different,
2 but I laugh at you for being the same.
3 Don't go around saying the world owes you a living.
4 The world owes you nothing. It was here first.
cat > b.txt << OFF生成文件
lychie@ubuntu:/test$ cat > b.txt << OFF
> ------ END ------
> OFF
lychie@ubuntu:/test$
> ------ END ------
> OFF
lychie@ubuntu:/test$
cat a.txt b.txt > c.txt合并 a.txt、b.txt 的内容并存储到 c.txt 中
lychie@ubuntu:/test$ ls
a.txt b.txt
lychie@ubuntu:/test$ cat a.txt b.txt > c.txt
lychie@ubuntu:/test$ ls
a.txt b.txt c.txt
lychie@ubuntu:/test$ cat -b c.txt
1 You laugh at me for being different,
2 but I laugh at you for being the same.
3 Don't go around saying the world owes you a living.
4 The world owes you nothing. It was here first.
5 ------ END ------
a.txt b.txt
lychie@ubuntu:/test$ cat a.txt b.txt > c.txt
lychie@ubuntu:/test$ ls
a.txt b.txt c.txt
lychie@ubuntu:/test$ cat -b c.txt
1 You laugh at me for being different,
2 but I laugh at you for being the same.
3 Don't go around saying the world owes you a living.
4 The world owes you nothing. It was here first.
5 ------ END ------
0 0
- linux命令------cat命令
- linux命令:cat 命令
- linux cat 命令详解
- linux cat命令
- Linux命令之:cat
- linux cat命令
- linux命令温故而知新:cat
- linux cat 命令详解
- linux cat 命令详解
- linux cat 命令详解
- linux cat 命令详解
- linux cat 命令详解
- Linux cat命令详解
- linux cat 命令详解
- Linux的cat命令
- linux命令之cat
- linux中cat命令
- linux cat 命令详解
- 解决C++ 无法从void 转换为LRESULT的方法详解
- (面试)C语言指针程序改错题
- 怎样使用JS代码代码跳转的方法
- DirectX 9.0c游戏开发手记之RPG编程自学日志之15: Drawing with DirectX Graphics (用DirectX图形绘图)(第8-9节)
- LeetCode-Maximum Product Subarray
- linux cat 命令
- 如何快速使用上C++11
- hdu5040 bfs
- 黑马程序员--Object-C和Swift内存管理机制
- 脱离屌丝422天
- 配置ssh免密码登录
- [LeetCode]Maximum Subarray
- How to set up a simple mail server on Debian in 5 easy steps
- sqlite replace失效的教训