Question: Using Bash programing language: Write a bash script to help me organize all my books on a computer. I want to enter a list of

Using Bash programing language:

Write a bash script to help me organize all my books on a computer. I want to enter a list of books with the following information:

Booktitle:

Author(s):

Publisher:

Year of publication:

Each item is to be kept in the file that will be simply called books. The script itself will be called bookinfo. This script will have one optional argument (an example of the command is given at the end). If it is a number, allow me to enter as many books as specified. If the argument is print, print the entire list of books to the file book_print. Print the books using the format I showed for entering data, but make sure that the file is formatted in columns.

Ill suggest organizing the books as one book per line, with different fields separated by the character .

Example of data in file (should be many lines of information formatted this way):

The Ultimate Hitchhikers Guide to the GalaxyDouglas AdamsDel Ray2002

Example of same entry in print (output of script):

Examples of the way to run it would be:

./bookinfo 3 george wind adventure (searches for each word individually and adds all matches)

./bookinfo -i the (search for all instances of and ignore case)

./bookinfo -i 2 parrot dog (search for all and all instances, ignoring case for both)

./bookinfo "multi word string" (search for all instances of 3 word sequence)

./bookinfo print (print all words to file)

The output of the matches would be one or more examples in the assignment, like:

Booktitle: The Ultimate Hitchhikers Guide to the Galaxy

Author(s): Douglas Adams

Publisher: Del Ray

Year of publication: 2002

Add an option to search for a pattern and print only the books that match the pattern. For example, the command

bookinfo -f "Douglas Adams" print

will only print the books that contain the pattern Douglas Adams anywhere in them. You should be able to handle regular expressions for search and ignore case if the option -i is specified. Submit a collection with at least ten books of your choice with the script. Specify any nice features you have added in a README file.

Note:

(This project will have a file that contains the book information and the script that will be used to search that file. The script itself, is called in the format described, which will search that document based on the command line arguments given to it. As for the "./", if your current directory is in your path then you do not have to precede commands with that. If your current directory is not in your path, then you have to specify "./" before a command so the shell will look in your current location for that file. If you place your script somewhere in your path, then you would not need to do "./".)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!