Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

There are14 questions asked. Don't attempted I've recently received a slew of incommplete responses, which is extremely frustrating. Please don't squander your or my time.

There are14 questions asked. Don't attempted I've recently received a slew of incommplete responses, which is extremely frustrating. Please don't squander your or my time. If you are unable to answer of my questions, please disregard them. I don't want to squander my paid-for post-question time. Also, if you continue to give me incompplete answer, I will give you a thumbs down and will complain. Thank you very much.

Answer the following questions.

1.What are the differences among grep, egrep and fgrep?

2.Which utility from Chapter 3 can be used to compress and decompress files? And how to compress multiple files into a single file? Please provide one example for it.

3.Which utility (or utilities) from Chapter 3 can break a line into multiple fields by defining a separator? What is the default separator? How to define a separator manually in the command line? Please provide one example for defining the separator for each utility.

Multiple Choices

4.What is the output of the following sequence of bash commands: echo 'Hello World' | sed 's/$/!!!/g'

a.!!!Hello World

b.Hello!!! World

c.Hello World!!!

d.!!!

e.No output on screen

5.Which awk script outputs the first field of lines that in the first five lines:

a.1 <= NF { print $5 }

b.NR >= 5 { print $1 }

c.1,5 { print $0 }

d.{print $1 }

e.None of above

6.What is the output of following command line:echo good | sed '/Good/d'

a. no output on screen

b.good

c.Good

d.good Good

e.None of above

7.Which awk script outputs all the lines where a plus sign + appears at the end of line?

a./^\+/{print $0}

b./+$/{print $0}

c./\+\$/{print $0}

d./\+$/{print $0}

e.None of above

8.Which command delete only the first 5 lines of "file"?

a.sed '5d' file

b.sed '1,5 p' file

c.sed '5dd' file

d.sed '5,$d' file

e.sed '1,5d' file

Write output of following commands and describe the function of commands (the last one only in each question)

9.$ cat float

Wish I was floating in blue across the sky, my imagination is strong, And I often visit the days

When everything seemed so clear.

Now I wonder what I'm doing here at all...

$ cat h1.awk

NR>2 && NR<4{print NR ":" $0}

awk -f h1.awk float

Output:

Function:

10.$ awk '/.*ing/ {print NR ":" $1}' float

Output:

Function:

11.

$ cat h2.awk

"Start to scan file" }

BEGIN { print

{print $1

","

$NF}

END {print

"END-" , FILENAME }

awk -f h2.awk float

Output:

Function:

12.sed 's/\s/\t/g' float

Output:

Function:

13.$ ls *.awk| awk '{print "grep --color 'BEGIN' " $1 }' |sh (Notes: sh file runs file as a shell script.)

Output:

Function:

14.$ mkdir test test/test1 test/test2

cat>test/test.txt

This is a test file

^D (CTRL + D)

$ cd test

$ ls -l . | grep '^d' | awk '{print "cp-r" $NF "" $NF ".bak"}' | sh

Output:

Function:

There are 14 questions asked. Don't attempted I've recently received a slew of incommplete responses, which is extremely frustrating. Please don't squander your or my time. If you are unable to answer of my questions, please disregard them. I don't want to squander my paid-for post-question time. Also, if you continue to give me incompplete answer, I will give you a thumbs down and will complain. Thank you very much.

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions