hi,
this one is a quick view of three tools at instance grep, sed and awk
GREP: grep tool is used to find the pattern in a text file.
for example
$ grep 'mani' /etc/passwd
this will show the lines which contains the pattern 'mani' in it.
for more: man grep
SED: sed is an stream editor tool. we can edit the file without opening it. it saves lots of time.
for an instance this will substitude all the too -> to in a samp.txt
$sed 's/too/to' samp.txt
to save the modified file have to redirect
$sed 's/too/to' samp.txt > moded.txt
for more: man sed
AWK: last but not least awk is an awesome tool.
this will split the text fields by tabs or whitespaces.
we can also set the delimiter.
example:
$df -h |awk '{print $1}'
this will print the first column of that df -h output.
for more: man awk
this one is a quick view of three tools at instance grep, sed and awk
GREP: grep tool is used to find the pattern in a text file.
for example
$ grep 'mani' /etc/passwd
this will show the lines which contains the pattern 'mani' in it.
for more: man grep
SED: sed is an stream editor tool. we can edit the file without opening it. it saves lots of time.
for an instance this will substitude all the too -> to in a samp.txt
$sed 's/too/to' samp.txt
to save the modified file have to redirect
$sed 's/too/to' samp.txt > moded.txt
for more: man sed
AWK: last but not least awk is an awesome tool.
this will split the text fields by tabs or whitespaces.
we can also set the delimiter.
example:
$df -h |awk '{print $1}'
this will print the first column of that df -h output.
for more: man awk
Comments
Post a Comment