欢迎来到三一文库! | 帮助中心 三一文库31doc.com 一个上传文档投稿赚钱的网站
三一文库
全部分类
  • 研究报告>
  • 工作总结>
  • 合同范本>
  • 心得体会>
  • 工作报告>
  • 党团相关>
  • 幼儿/小学教育>
  • 高等教育>
  • 经济/贸易/财会>
  • 建筑/环境>
  • 金融/证券>
  • 医学/心理学>
  • ImageVerifierCode 换一换
    首页 三一文库 > 资源分类 > DOC文档下载  

    linux下cat命令详解(Linux under cat command detailed).doc

    • 资源ID:9008177       资源大小:30.50KB        全文页数:10页
    • 资源格式: DOC        下载积分:4
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录 QQ登录   微博登录  
    二维码
    微信扫一扫登录
    下载资源需要4
    邮箱/手机:
    温馨提示:
    用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP免费专享
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    linux下cat命令详解(Linux under cat command detailed).doc

    linux下cat命令详解(Linux under cat command detailed)Linux under cat command detailedAbridged edition:Cat has three main functions:1. displays the entire file at a time. $cat filename2. create a file from the keyboard. $cat > filenameOnly new files can be created, and existing files cannot be edited3. combine several files into one file: $cat, file1, File2 > fileParameter:The -n or -number starts with 1 and the number of rows for all outputs is numbered-b or -number-nonblank is similar to -n except that the blank line is not numbered-s or -squeeze-blank, when it encounters a blank row of more than two lines, is replaced with a blank row of rows-v or -show-nonprintingCases:Add the file number of the textfile1 to the textfile2 file after adding the line numberCat, -n, textfile1 > textfile2Append the file contents of textfile1 and textfile2 to the line number (blank line is not added) and append the contents to textfile3."Cat -b textfile1 textfile2" textfile3Throw the test.txt file into the trash box and assign the value to test.txtCat /dev/null > /etc/test.txtDetailed:Turn: http:/blog.sina.com.cn/s/blog_52f6ead0010127xm.htmlCat is a text file view and connection tool. To view the contents of a file, using cat is relatively simple, that is, cat directly followed by the file name.Such as:De>rootlocalhost cat /etc/fstabde> #To help novice brothers master this tool flexibly, lets say a few more common parameters;1 cat syntax structure;De>cat options files. De>option-A, -show-all is equivalent to -vET-b, -number-nonblank for non null output line numbers-e is equivalent to -vE-E, -show-ends displays $at the end of each line-n, -number for all lines of output-s, -squeeze-blank does not output multiple rows of blank lines-t and -vT are equivalent-T, -show-tabs displays the skip character as I-u (ignored)-v, -show-nonprinting uses and M- references, except for LFD and TAB-help displays this help information and leaves1.1 cat view file content instance;Note: profile /etc/profile cat de>rootlocalhost # to view the contents of the file under the /etc/ directory;rootlocalhost # cat -b /etc/fstab note: profile to view the contents of the /etc/ directory, and the number of non blank line line number, starting from 1;rootlocalhost # cat -n /etc/profile note: all the rows in the /etc directory of the profile (including blank line) number display;rootlocalhost # cat -E /etc/profile note: profile to view the contents of the /etc/, and in each line at the end of the additional $de> symbols;The cat plus parameter -n is similar to the NL tool, and the line number is added in front of each row while the file content is output;De>rootlocalhost cat -n /etc/profile #rootlocalhost NL /etc/profilede> #Cat can display the contents of multiple files at the same time, for example, we can display the contents of two files at the same time on a cat command;De>rootlocalhost cat /etc/fstab /etc/profilede> #Cat for the content of great files, can be sent to the more through the pipeline | tool, and then see a page;De>rootlocalhost cat /etc/fstab /etc/profile morede> | #1.2 cat creation, connection file function examples;Cat has the ability to create files. After you create a file, you want to end it with EOF or STOP;De>rootlocalhost # cat > linuxsir.org.Txt "EOF note: create linuxsir.org.txt file"> Ill test cat, create the file, and enter the contents for the file. Note: This is to enter the contents for the linuxsir.org.txt file;> north, South, North and South test. Note: This is to enter the contents for the linuxsir.org.txt file;> EOF note: exit edit status;rootlocalhost # cat linuxsir.org.txt note: we check the contents of the linuxsir.org.txt file;Ill test cat, create the file, and enter the contents for the file;North, South, North and South tests; de>Cat also has the capability to append content to existing files;De>rootlocalhost # cat linuxsir.txt note: linuxsir.txt file to view the contents of the existing;I, am, BeiNanNanBei, From, LinuxSir.Org. Note: content lineIm writing a document for the cat commandrootlocalhost cat "linuxsir.txt" EOF # note: we append to the linuxsir.txt file;> Ill test the cats ability to append content to the document; note: This is the content that was recovered> OK?> OK !> north, South, upward> EOF note: exit with EOF;rootlocalhost cat linuxsir.txt # note: view the contents of the documents, to see whether successful recovery.I, am, BeiNanNanBei, From, LinuxSir.OrgIm writing a document for the cat commandIll test the cats ability to append content to the document;OK?OK North and South are on de>Cat connects the contents of multiple files and outputs them to a new file;Lets say we have sir01.txt, sir02.tx, and sir03.txt, and the contents are as follows;De>rootlocalhost cat sir01.txt #One hundred and twenty-three thousand four hundred and fifty-sixI am testingrootlocalhost cat sir02.txt #Fifty-six thousand seven hundred and eighty-nineBeiNan Testedrootlocalhost cat sir03.txt #09876Linuxsir.org testingde>I want to connect the three files of sir01.txt, sir02.txt, and sir03.txt by cat (that is, the contents of these three files are joined together) and output to a new file, sir04.txt.Note: the principle is to connect the contents of the three files, then create the sir04.txt file and write the contents of several files to the sir04.txt. It is particularly worth mentioning that if you enter an existing sir04.txt file, you will empty the sir04.txt content.De>rootlocalhost cat sir01.txt sir02.txt sir03.txt > sir04.txt #rootlocalhost more sir04.txt #One hundred and twenty-three thousand four hundred and fifty-sixI am testingFifty-six thousand seven hundred and eighty-nineBeiNan Tested09876Linuxsir.org testingde>Cat appends one or more existing file contents to an existing fileDe>rootlocalhost cat sir00.txt #Linuxsir.org foreverrootlocalhost cat sir01.txt sir02.txt sir03.txt sir00.txt #rootlocalhost cat sir00.txt #Linuxsir.org foreverOne hundred and twenty-three thousand four hundred and fifty-sixI am testingFifty-six thousand seven hundred and eighty-nineBeiNan Tested09876Linuxsir.org testingde>Warning: we want to know > > means create, > append. Dont mix up. A mistake is not a joke;

    注意事项

    本文(linux下cat命令详解(Linux under cat command detailed).doc)为本站会员(rrsccc)主动上传,三一文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三一文库(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    经营许可证编号:宁ICP备18001539号-1

    三一文库
    收起
    展开