Professional Documents
Culture Documents
General File Commands
General File Commands
General File Commands
$read variable-name
R – read
h- hide
PIPES (mechanism which takes output of a command as its input for the next
command)
$who |wc (output from who is input of wc -------then result is displayed)
FILTERS
To extract lines which contain a specific pattern
2 types
1. GREP
2. SORT – to sort in alphabetical order
$sort
Abc
Xyz
Ctrl+d
(press enter ---- result is in sorted order)
$sort –r (in reverse alphabetical order)
$sort –f (to ignore the case distinction)
$sort –n (to sort numbers)
$grep “pec” abc (searches for lines containing pec in file abc and displays them)
$grep “b$” abc (extracting lines that end with b in file abc and displays them)
$grep “^t” abc (extracting lines that start with t in file abc and displays them)
$fgrep “pec is a” abc (only those lines which contain this string as a whole)
$egrep “(ica)$” abc (searches for the string ica in the file abc , it may be in any word also)