欢迎来到天天文库
浏览记录
ID:40558873
大小:46.50 KB
页数:5页
时间:2019-08-04
《Linux命令cat运用讲解lianxi》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、Linux命令cat运用讲解Linux命令cat-concatenatefilesandprintonthestandardoutput把文件连接后输出到屏幕上,其实就是查看文件内容。 你们知道什么是Linux命令么这个非常高深的运用技术将由我来非常讲解,Linux命令NB在哪呢,下面我来进入讲述Linux命令的无限领域。 Linux命令cat-concatenatefilesandprintonthestandardoutput把文件连接后输出到屏幕上,其实就是查看文件内容。 SYNOPSIScat[OPTION][FI
2、LEDESCRIPTIONConcatenateFILE(s),orstandardinput,tostandardoutput. -A,show-allequivalentto-vET--等同与参数-vET -b,number-nonblanknumbernonblankoutputlines--对空白行不编号,与-n有相似。 -e,equivalentto-vE--等同与参数-vE -E,show-endsdisplay$atendofeachline--每行以$符号为行结尾 -n,numbernumberallo
3、utputlines--由1开始对所有输出的行数编号 -s,squeeze-blanknevermorethanonesingleblankline--当遇到连续2行以上的空白行,只保留一行空白行 -t,equivalentto-vT -T,show-tabsdisplayTABcharactersas^I -u,(ignored) -v,show-nonprintinguse^andM-notation,exceptforLFDandTAB Linux命令练习: [root@CentOS4ok_008]#catm
4、ytestHelloworld! Helloworld1 Helloworld2 helloworld3 [root@CentOS4ok_008]#cat-nmytest Helloworld! Helloworld1 Helloworld2 helloworld3 [root@CentOS4ok_008]#cat-bmytest 1Helloworld! 2Helloworld1 3Helloworld2 4helloworld3从以上Linux命令我们可以验证-n与-b的差异。 [root@Cen
5、tOS4ok_008]#cat-b-Emytest 1Helloworld!$ 2Helloworld1$ 3Helloworld2$ 4helloworld3$ 每行以$符号为行结尾 现在想合并mytest和oktest两个文件的内容成一个新的文件NewTest.txt[root@CentOS4ok_008]#ls-ltotal24-rw-r--r--1rootroot59Sep1819:48mytestdrwxr-xr-x3rootroot4096Sep1322:51ok-rw-r--r--1rootroot21
6、Sep1720:45oktest[root@CentOS4ok_008]#catmytestoktest>>newtest.txt[root@CentOS4ok_008]#ls-ltotal32-rw-r--r--1rootroot59Sep1819:48mytest-rw-r--r--1rootroot80Sep1819:53newtest.txtdrwxr-xr-x3rootroot4096Sep1322:51ok-rw-r--r--1rootroot21Sep1720:45oktest查看新的文件newtest.txt的内
7、容:[root@CentOS4ok_008]#cat-bnewtest.txt 1Helloworld! 2Helloworld1 3Helloworld2 4helloworld3 5thisisatestfile. 合并两个文件的内容[root@CentOS4ok_008]#catmytestoktest>newtest1.txt[root@CentOS4ok_008]#ls-ltotal40 -rw-r--r--1rootroot59Sep1819:48mytest -rw-r--r--1rootroot80
8、Sep1819:56newtest1.txt -rw-r--r--1rootroot80Sep1819:53newtest.txt drwxr-xr-x3rootroot4096Sep1322:51ok -rw-r--r--1rootroot21Sep17
此文档下载收益归作者所有