Using the terminal to search and organize?

Can anyone help me with this?

They give me a list of authors and books I’m supposed to copy into the terminal.

  1. List all books that were written by “Dan Brown”
  2. Using a single command, create a new file called sorted_books.txt that contains a list of the books in books.txt by sorted by title.
  3. Using a single command, create a new file called books_by_george_orwell.txt which should only contain those books by George Orwell, sorted by title.

And then the challenge which I believe should be using a wild card (.*)

Create a new file called authors.txt which lists only the authors of the books, alphabetized by first name. The list should be unique (i.e. Dan Brown is not listed twice) and should be numbered.

I’m so lost with trying to use grep and other flags, I’m pretty lost. :confused:

@camperextraordinaire I’d love to hear your input. This is my introduction to regex.

Can you link to the full lesson you’re following? It would help to see what you’re expected to know at this point. In this case, grep can take a regex as simple as the author name. If you run the command you’ve posted above, you’ll have a file books.txt that you can cat out and practice with.

:$ cat books.txt | grep Mockingbird
To Kill a Mockingbird by Harper Lee
1 Like