Grep Command in Unix Shell script
Consider the below file with data cat sample_file.txt linux storage unix distributed system linux file server debian server fedora backup server Let see the bash script that prints the lines which contain the word server in it. The bash script code is shown below: vi grep_script.sh #!/bin/bash WORD=server INPUT_FILE=sample_file.txt grep "$WORD" $INPUT_FILE Now we will execute this script and see what the output is > bash grep_script.sh linux file server debian server fedora backup server