Sessions 7 8 9 Unix Filters Advanced Commands
Sessions 7 8 9 Unix Filters Advanced Commands
Unix filters
Modifying data in a file
Splitting a file: split
Sorting files: sort
Character string conversion: tr
Editing files with criteria
Editing a file from the end: tail
Editing a file from the beginning: head
Count the lines in a file: wc
Editing fields in a file: cut
Merging files: paste
Extraction of common lines from two files: comm
Comparing files
Compare two files: cmp
Editing differences between two files: diff
1st Year Engineering Computer Science Tlemcen University November 2023 2
Outline
grep and find commands
Regular expressions
grep command
find command
The tr command
The tr command is a UNIX command-line utility for converting
or deleting characters.
It supports a range of transformations, including converting
uppercase characters to lowercase, overwriting repetitive
characters, and deleting specific characters.
It can be used with UNIX pipes to perform more complex
translations.
Syntax :
tr [OPTION] SET1 [SET2]
tr replaces each character in the input stream belonging to the
SET1 with the character of the same rank in the SET2.
. Generic character
^ Beginning of line
$ End of line