Professional Documents
Culture Documents
CM304
CM304
CM304
ANDHRA PRADESH
Name : A V N L Sarojini
Designation : Lecturer
Branch : Computer Engineering
Institute : A.A.N.M. & V.V.R.S.R. Poly.,
Gudlavalleru.
Year/Semester : III Semester
Subject : UNIX & C
Subject Code : CM-304
Topic : Shell Programming &
Filtering Techniques
Duration : 50 Min
Sub Topic : Filtering Techniques
Teaching Aids : PPT
CM304.21 1
Objective
sort command
unique command
tee command
CM304.21 2
Recap
CM304.21 3
sort command
CM304.21 4
sort command
CM304.21 5
sort command options
Options Description
-t (char) Uses delimiter character to identify fields
-o
Places output in file filename
filename
-m file Merges sorted files in file.
+k Starts sorting after skipping the kth field.
CM304.21 6
sort command options
Options Description
-k Starts sorting after the kth field.
-r Reverses sort order.
-n Numeric order.
CM304.21 7
sort command
CM304.21 8
sort command
CM304.21 9
sort command
When sort acts on numbers it sorts the numbers by
ASCII collating sequence. This can be over ridden
by the ‘-n’ option.
$cat > temp $sort temp $sort -n temp
1 1 1
4 10 4
24 24 8
8 4 10
10 8 24
CM304.21 10
sort command
CM304.21 11
unique command
UNIX offers a special tool to handle duplicate
records using uniq command.
Example: cat > temp $sort -o temp temp|uniq
1 swaroop
1 Swaroop
2 anand
3 sateesh 2 anand
5 venu 3 sateesh
2 sai ram
5 venu
3 padmaja
CM304.21 12
unique command
CM304.21 13
unique command
-u option:
CM304.21 14
unique command
CM304.21 15
tee command
CM304.21 16
tee command
CM304.21 17
Summary
CM304.21 18
Quiz
[TRUE / FALSE]
CM304.21 19
Quiz
[TRUE / FALSE]
CM304.21 20
Quiz
[TRUE/FALSE]
CM304.21 21
Quiz
[TRUE/FALSE]
CM304.21 22
Quiz
[TRUE/FALSE]
CM304.21 23
Quiz
[TRUE/FALSE]
CM304.21 24
Frequently Asked Questions
CM304.21 25