Question: Write a sed script that works as below. It takes the name of a data file via input redirection. The file used for redirection is

Write a sed script that works as below.

It takes the name of a data file via input redirection. The file used for redirection is the output of the command

ls l | tail n +2 >lsfile

Here is a sample content of the file.

-rw-r--r-- 1 cfs264sp170225 cfs264sp1702 21 2017-04-16 d1

drwxr-xr-x 2 cfs264sp170225 cfs264sp1702 4096 2017-04-16 dir1

-rw-r--r-- 1 cfs264sp170225 cfs264sp1702 181 2017-04-16 lsfile

-rwxr-xr-x 1 cfs264sp170225 cfs264sp1702 179 2017-04-16 p1

-rwxr-xr-x 1 cfs264sp170225 cfs264sp1702 14 2017-04-16 p2

-r--r-xr-x 1 cfs264sp170225 cfs264sp1702 828 2017-04-16 signindata

-rw-r--r-- 1 cfs264sp170225 cfs264sp1702 210 2017-04-16 x

It prints the records of all files that were last updated on April 25, 2017. It must print nothing else.

For example, here is a possible display, which is cooked up because April 25 is a future date.

-r-xr-xr-x 1 cfs264sp170225 cfs264sp1702 40 2017-04-25 abcd

-r--r-xr-x 1 cfs264sp170225 cfs264sp1702 28 2017-04-25 efgh

-rw-r--rw- 1 cfs264sp170225 cfs264sp1702 140 2017-04-25 pqr

The program must work when executed as below.

$ ./p4< name-of-file-that-contains-ls-l-info>

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!