shell基础--cat命令的使用
一.cat的常用用法
1.总结

2.实验
(1).非交互式编辑
[root@~_~ day5]# cat > cattest.sh <<STOP
> hello
> STOP
[root@~_~ day5]# cat cattest.sh
hello
[root@~_~ day5]# cat > cattest.sh << EOF
hello cat with EOF
EOF
[root@~_~ day5]# cat cattest.sh
hello cat with EOF
[root@~_~ day5]# cat > cattest.sh <<~_~
> hdhhdhdhhdhd
> ~_~
[root@~_~ day5]# cat cattest.sh
Hdhhdhdhhdhd
(2).清空文件内容
[root@~_~ day5]# cat cattest.sh
Hdhhdhdhhdhd
[root@~_~ day5]# cat /dev/null > cattest.sh
[root@~_~ day5]# cat cattest.sh
(3).合并
[root@~_~ day5]# cat > cattest.sh <<EOF
> hello
> EOF
[root@~_~ day5]# cat > cattest2.sh <<EOF
> world
> EOF
[root@~_~ day5]# cat cattest.sh cattest2.sh >newfile.sh
[root@~_~ day5]# cat newfile.sh
hello
world
[root@~_~ day5]# cat newfile.sh
hello
world
二.cat命令常用选项
1.总结

shell基础--cat命令的使用的更多相关文章
- shell基础--test命令的使用
test :用于文件类型检查和变量比较 一.用途: 1.判断表达式 2.判断字符串 3.判断整数 4.判断文件 测试例子: (1).test [root@~_~ day5]# cat test.sh ...
- [shell基础]——sed命令
关于sed sed 是一种在线编辑器,它一次处理一行内容.处理时,把当前处理的行存储在临时缓冲区中,称为“模式空间”(pattern space),接着用sed命令处理缓冲区中的内容,处理完成后,把缓 ...
- [shell基础]——read命令
read命令:在shell中主要用于读取输入.变量.文本 1. 接受标准输入(键盘)的输入,并将输入的数据赋值给设置的变量 [按回车键——表示输入完毕] [若输入的数据多于设置的变 ...
- [shell基础]——sort命令
sort命令 sort是按照ASCII码升序输出,且是从首字符依次向后比较的 常见选项 -c 测试文件是否已经被排序 -r 逆向排序 -n 按照数字数值大小排序 -t 指定分割 ...
- [shell基础]——uniq命令
uniq命令常见选项 去除重复行 -u 显示不重复的行 -d 显示有重复的行 -c 打印每一行重复的次数 测试文本内容如下: # cat 4.txt 11 ...
- [shell基础]——cut命令
cut命令常见选项
- [shell基础]——find命令
find命令选项 -name 按照文件名查找 -type 查找某一类型的文件(b 代表设备块:d 目录:c 字符设备文件:l 符号(软)链接文件:f 普通文件) -size 查找文件长度或者大小 -p ...
- [shell基础]——echo命令
echo命令:在shell中主要用于输出 1. -n 不换行的显示结果(默认是换行的) 2. -e " " 支持双引号中使用一些特殊字符 常用的特殊字符有 \a 发出警告 ...
- [shell基础]——tr命令
(1) tr 字符替换 测试文本内容 # cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4. ...
随机推荐
- Packet for query is too large (5,145 > 1,024). You can change this value on the server by setting the 'max_allowed_packet' variable.
错误 在使用Mybatis generator时提示MySQL写入过大 Packet for query is too large (5,145 > 1,024). You can change ...
- IDEA 中将已有项目放到 GitHub 上去
前言:公司用的都是 idea+svn 来管理代码,所以家里尝试一下 idea+github 来管理.我的本地仓库是配置过ssh key,所以此处没有再次配置ssh key,如需配置可以参考 https ...
- Java8简明学习之Optional
Java在8的版本,新增了Optional和lambda表达式,使得日常开发中对于NullPointException的判断变的优雅. 现在来个例子看看在Optional之前对空的判断. @Test ...
- 1415. [NOIP2001]数的计数
☆ 输入文件:nums.in 输出文件:nums.out 简单对比 时间限制:1 s 内存限制:256 MB [题目描述] 我们要求找出具有下列性质数的个数(包含输入的自然数n): 先 ...
- Xcode 7安装KSImageNamed 不启作用
1. 到 ~/Library/Developer/Xcode/Plug-ins 删除KSImageNamed.xcplugin 2. 在~/Library/Developer/Xcode/Plug- ...
- Spring Boot—19Session
pom.xm <dependency> <groupId>org.springframework.boot</groupId> <artifactId> ...
- 企业实施ERP的先后步骤,你真的了解吗?
信息化是我国加快实现工业化和现代化的必然选择.坚持以信息化带动工业化,以工业化促进信息化,在国民经济和社会领域广泛采用信息技术.国民经济信息化中企业的信息化工作是基础, ERP管理系统是IT技术和先进 ...
- 解决提交项目到GitHub,报错Please tell me who you are的问题
描述: 在第一次提交项目到GitHub时,出现了以下问题 看了一下错误原因:Run git config --global user.email "you@example.com" ...
- Vue 框架-09-初识组件的应用
Vue 框架-09-初识组件的应用 今天的第一个小实例,初步使用组件: 在 app.js 中定义模板组件,在 html 文件中使用自定义标签来显示 js 文件中定义的 html 代码块 比如说,下面定 ...
- 单位换算 M、Mb、MB
硬盘单位和存储单位 硬盘单位 存储空间 K M G Kb Mb Gb 1k =1000 bytes 1m = 1000000 bytes 1g = 1000000000 bytes 1kb ...