Grep Command bash script programming Linux UNIX shell programming

Grep command used to filter the data. Example in the redhat.txt file it has the word rhel5. You can list out line with has the word rhel5. So the grep command is used for this purpose.
Source code bash shell Programming Algorithm
[redhat35@localhost Rhel5]$ cat>god
god is great
god is present everywhere
[2]+ Stopped cat>god
echo “displaying a string from a file”
echo “get file name”
read s
echo “get string”
read i
grep $i $s

OUTPUT CS1252 Operating Systems lap
[redhat35@localhost Rhel5]$ grep.sh
displaying a string from a file
get file name
god
get string
great
god is great

Post a Comment

1 Comments

  1. pretty useful post man, you have indeed covered topic in detail with samples. I have also blogged my experience as grep command in unix with examples
    ,let me know how do you find it. Thanks

    ReplyDelete