My .txt
file contains these kind of content :
The Law and Lawyers of Pickwick, by Frank Lockwood 21214
Frankenstein, by Mary Wollstonecraft 20
The first string is book name,second is author and the last one is book number. I want to print the whole line when someone search with the author name.I tried using grep.
#!/bin/bash
BOOKFILE="/home/sk/GUTINDEX.ALL"
author=$1
if [[ -z "$author" ]]; then
echo -n "Author name : "
read author
fi
grep $author $BOOKFILE
If I run this and search for Frank Lockwood it prints both the lines.But I want to print the line when the entire input string match(both the first name and last name)