Tac
TAC is the anti-write of cat, that is, reverse-order display file contents
such as file A.txt content as follows:
12345
The TAC A.txt is printed as follows:
5
4
3
2
1
We can use awk to implement the capabilities of the TAC:
awk ' {arr[nr]=$0}end{for (count=nr;count>0;count--) print Arr[count]} ' a.txt
This is just an iteration, we can also use various loop tools (For/while) to implement the TAC command
Comm
Comm is to compare two files (two files must be in order), and output 3 columns, the first column is only the contents of the previous file, the second column is only the contents of the following file, the third column is the contents of both files
The sorting of the files can be ordered using the command sort, which is the sort a.txt
How to use: Comm file1 file2
Of course, we can also specify that a column is not displayed, such as not showing the second column (that is, only the content in the second file is not displayed), it can be written as:
Comm-2 file1 file2
Do not display the third column (that is, both files do not display), you can display as:
comm-3 file1 file2
If two or three columns are displayed, there is a space in front (actually the TAB key) and we can use TR to remove:
Comm File1 File2 | Tr-d ' \ t '
The tac/comm of some simple commands in Linux