i'm new in shell programing. I want a text file as my database like this
Booktitle
abcd
Author
abcd
Publisher
abcd
Year of publication
2009
How can i use any keyword and let the program find all the information of that book. For example: When i type grep -i "abcd" books.txt
. The program will show:
Booktitle Author Publisher Year of Publication
abcd abcd abcd 2009
Thank you guys so much!
grep
only gives you lines, not groups of lines. You might want to format the file differently. One way is to construct the lines byid seporator tag seporator data
like so:
When you use the book title as your id
grep
will give you all the information of a book when you search with the title.