cat

Concatenate multiple files and print to standard output.

Summary

cat [OPTION]... [FILE]...

The main purpose

Parameters

FILE (optional): The file to be processed, which can be one or more.

Options

Long options are equivalent to short options

-A, --show-all Equivalent to the "-vET" combination option.
-b, --number-nonblank Only number non-blank lines, starting from 1, overriding the "-n" option.
-e is equivalent to the "-vE" combination option.
-E, --show-ends Display '$' characters at the end of each line.
-n, --number Number all lines, starting from 1.
-s, --squeeze-blank Squeeze consecutive blank lines into one line.
-t is equivalent to the "-vT" combination option.
-T, --show-tabs Use "^I" for TAB (tab character).
-u POSIX compatibility option, meaningless.
-v, --show-nonprinting Use "^" and "M-" symbols to display control characters, except LFD (line feed, that is, newline character '\n') and TAB (tab character).

--help Display help information and exit.
--version Display version information and exit.

return value

The return status is success unless illegal options or illegal parameters are given.

example

# Combine and display multiple files
cat ./1.log ./2.log ./3.log
# Display non-printing characters, tabs, and newlines in the file
cat -A test.log
# Blank lines in compressed files
cat -s test.log
# Display the file and append line numbers to the beginning of all lines
cat -n test.log
# Display the file and append line numbers to the beginning of all non-blank lines
cat -b test.log
# Display the contents of standard input and the contents of the file together
echo '######' |cat - test.log

Notice

Reference link