Shell Data Processing - Cat command (short for concatenate)

Card Puncher Data Processing

About

cat generates a stream of data from one or more files

It therefore concatenate files.

Example

Concatenate files

file 1 - line 1
file 1 - line 2


file 2 - line 1
file 2 - line 2

  • Output file1.txt then file2.txt contents and redirect and create the file fileAll.txt
cat file1.txt file2.txt > fileAll.txt
  • Content of fileAll.txt
cat fileAll.txt
file 1 - line 1
file 1 - line 2
file 2 - line 1
file 2 - line 2

Concatenate Output files selected with a glob pattern

Output all files with the pgn extension

cat *.pgn

where: *.pgn is a glob pattern

Concatenate Output files and standard input

Concatenate the output of file and of standard input

cat f - g

where:

Example:

  • As a prerequisite, we create two files f and g that contains the text Hello World with the help of tee that redirect the output of the echo command to this files.
echo 'Hello World' | tee f g

Copy standard input to standard output

Without any argument, cat will copy standard input to standard output

cat

Example:

  • As prerequisites, we create of a input file
echo 'Hello World' > helloIn.txt
cat < helloIn.txt > helloOut.txt
  • Result: showing the content of helloOut.txt with cat
cat helloOut.txt
Hello World





Discover More
Git - Blob

blob in git is a object of the blob type that corresponds / represents the file contents (or inodes) in the git file system. file This command will put a blob in the object database where: the...
Git - Objects (Database)

An object is the value in the entry of the git database key-value. All entities in git are objects. Objects are the entity of the Git file system. On the operating file system, the objects are stored...
Bash Liste Des Attaques Ovh
Linux - File

Linux file management See Using Parameters Expansion Removal From a path string where the file does not exist dirname returns the first parent of an existing path file. ...
Map Of Internet 1973
Network - netcat (nc, ncat)

netcat is a net client/server command line tool for TCP or UDP protocol. It can: reads and writes data across network connections acts as a client but also as a server You can see it as the equivalent...
Bash Liste Des Attaques Ovh
Sh - Backslash Escape Characters (Whitespace, Tabs, Ends, End of Line, Newline) - Non-printing characters

in bash Words of the form $'string' are treated specially. The word expands to string, with backslash-escaped characters replaced as specified by the ANSI C standard. Backslash escape sequences,...
Card Puncher Data Processing
Shell Data Processing - (WC|Word Count) command (Line count)

The wc command is a filter that prints on one line sequentially the number of: newlines (lines), words, and characters from: files or from an input stream when: no FILE is specified or...
Card Puncher Data Processing
Shell Data Processing - Filter (Stream Operator)

This page is pipeline operator in a shell language. They are known as filter in a shell language. It is a computer program or shell command (subroutine) that: read from standard input (stream)...
Card Puncher Data Processing
Shell Data Processing - Standard Input Stream (Stdin)

in a shell cat will start a standard input session You can redirect it to a file. If your command needs plain input without terminal emulation you can use input redirection with a pipe like:...
Card Puncher Data Processing
Shell Data Processing - Standard Output Stream (stdout)

The Standard Output Stream is the output stream of a command To create a file from a standard output stream, you use the redirected Example: The echo command with the argument Hello World create...
Card Puncher Data Processing
Shell Data Processing - Stream

This page is the creation of Stream in the Shell context. You start a stream with an initialization function that creates a standard output such as: grep ... You connect then: the first...



Share this page:
Follow us:
Task Runner