Question
Can someone help me with bash Linux using Grep commands Write a bash script named raven.sh that runs the following grep commands in a sequence.
Can someone help me with bash Linux using Grep commands
Write a bash script named raven.sh that runs the following grep commands in a sequence. Before each grep, print the problem number. Use the file raven.txt as the input file to your grep commands. 1) Show all the lines that contains "raven". 2) Pick out the blank lines in the file: (find lines that start and end with nothing in between.) - You will need to print out the line numbers on this one. 3) Pick out lines that contain rep, word, or more. 4) Pick out all the lines with v, z , j, or I in them. 5) Pick out all the lines that end with a dash - 6) Pick out all the lines that do not start with an uppercase letter. Show the line numbers. 7) Pick out all lines that contain the word 'more' (not part of another word like 'Nevermore') . 8) Count the number of lines that contain 'whose' 9) Count the number of lines that contain nevermore in them, regardless of case. 10) Count the number of lines that do not contains the word raven. (Hint, use inverse flag)
This is my shell
#!/bin/bash # 1 - show all lines that contain the word raven echo "Problem 1" grep raven raven.txt # 2 - show all line numbers that are blank echo "Problem 2"
# 3 - show all lines that contain 'rep' 'word' or 'more' echo "Problem 3"
# 4 - show all lines with v,z,j or I in the them echo "Problem 4"
# 5 - show all lines that end with a dash echo "Problem 5"
# 6 - lines that don't start with uppercase echo "Problem 6"
# 7 - Pick out all lines that contain the word 'more'. echo "Problem 7"
# 8 - Count the number of lines that contain 'whose' echo "Problem 8"
# 9 - count nevermore regardless of case echo "Problem 9"
# 10 - count lines that don't contain raven echo "Problem 10"
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started