Simple Linux Command Line notes: Cat

Source: Internet
Author: User
ArticleDirectory
    • Parameters
    • Option
    • Example

Connect or display files

Cat[Options] [File-list]

 

Parameters

File-listYesCatThe path name of a single file to be processed or the list of path names of multiple files. If no parameter is specified or a hyphen (-) is specified to replace the file name, cat reads the information from the standard input and prints

 

Option

-E: display at the end of each line $

-N: Number of all rows output

-B indicates the numbers of all non-empty rows in the output.

-S: deletes multiple consecutive blank rows. Only one row is retained.

-T use ^ I to display each tab (Tab)

 

Example Cat-
 
$CatHellohello $Cat-Worldworld

Read and print, CTRL + D indicates exit

 

Cat-e
 
$Cat-All people who can make an appointment with E demo $

Dollar sign printed at the end of the sentence

 

Cat-n
$Cat-N demo1All people who can make an appointment234Enough food to eat567I am very talkative.89Desperate than crying10How can this problem be solved?

Number of all rows

 

Cat-B
$Cat-B demo1All people who can make an appointment2Enough food to eat3I am very talkative.4Desperate than crying5How can this problem be solved?

All non-empty row numbers

 

Cat-S
 
All the people who can make an appointment are about to eat enough food, so they can use their power to talk about laughter and cry. How can they get beaten?

Delete unnecessary blank rows

 

Cat-T
$Cat-T the demo can be used by people who can make an appointment.^ I use ^ I force ^ I ^I laugh than cry, how can I get beaten?

Print the tab to ^ I

 

Cat> File
 
$Cat>A.txt hello

Write to the file and press Ctrl + D to exit. In addition,> used to append data, rather than Overwrite

 

Cat file File> File
 
$CatA.txt B .txt>C.txt $CatC.txt helloworld

Connect multiple files to the same file

 

Tips

1. Cat is used to display short character files. The effect is very good.

2. Cat can splice multiple files. In addition, the file splitting method is also described later.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.