Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Part III: Write output of following commands and describe the function of comman

ID: 3873690 • Letter: P

Question

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

1) $ 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:

2) $ awk '/.*ing/ {print NR ":" $1}'

Output:

Function:

3) $ cat h2.awk

BEGIN { print "Start to scan file" }

{print $1 "," $NF}

END {print "END-" , FILENAME }

$ awk -f h2.awk float

Output:

Function:

4) $ sed 's/s/ /g' float

Output:

Function:

5) $ ls *.awk| awk '{print "grep --color 'BEGIN' " $1} ' |sh

(Notes: sh file runs file as a shell script.)

Output:

Function:

6) $ 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:

Explanation / Answer

1) it states that the total content

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...

is there in the directory named Float . and the we are accesing a h1.awk file which consists of the content NR==2||NR==4{Print NR " " $0} .

and the third statement states that we are accessing a file named h1.awk in the directory named float

2) it says that to print what ever there in the print statement from the directory named float .

3)BEGIN { print "Start to scan file", FILENAME}

{print NR","NF}

END {print "END"}

this information is present in h2.awk and we are accessing h2.awk from the directory float

5) displays all the files with awk as extension and prints the print statement .

6)mkdir means to make directory so mkdir $test 1 makes a directory named test 1 .