Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 1 Lnai 9284

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Carlos Soares ,Joao Gama ,Alipio Jorge

1st Edition

3319235273, 978-3319235271

More Books

Students also viewed these Databases questions