Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / That English paper you were writing on the works of Lewis Carroll is due in a few hours and you have forgeotten the name of the text file in which you has written a number of quotations to use in your paper

That English paper you were writing on the works of Lewis Carroll is due in a few hours and you have forgeotten the name of the text file in which you has written a number of quotations to use in your paper

English

That English paper you were writing on the works of Lewis Carroll is due in a few hours and you have forgeotten the name of the text file in which you has written a number of quotations to use in your paper. Luckily, you know that the file is somewhere in your ~/UnixCourse directory or in some subdirectory directly or indirectly within it. You also know that the file name ended in ‘.txt’. You are pretty sure that you could recognize the file from just the first line.

You seem to recall having heard that there is a Unix command head that will print the first few lines of any file and suspect that, with the proper parameters, it could be used to print just the first line. (Hint - part of your task in this question is to show that you can use the built-in Unix help facilities.)

But you really don’t want to type that command out for every file or even every directory. What command would you give to produce a listing of the names of all the text files (as absolute paths) in ~/UnixCourse or its subdirectories (possibly nested several layers deep) followed immediately by the first line of text within that file? E.g., to produce a listing looking like this:

/home/yourname/UnixCourse/foo.txt
When in the course of human development
/home/yourname/UnixCourse/Quotations/bar.txt
Curiouser and curiouser!

Note that the output format must look like the example above. (That’s not unreasonable, as one of the things you should have learned from this lesson is that the output of one command is often fed into later commands, which must be able to read it.) In particular, all files should be listed and absolute paths and solutions that add extraneous characters around the file name (e.g., << or ==>) are not correct.

Option 1

Low Cost Option
Download this past answer in few clicks

5.87 USD

PURCHASE SOLUTION

Already member?


Option 2

Custom new solution created by our subject matter experts

GET A QUOTE

Related Questions