Menu

[Solved]-1 Give Command Single Command Pipelined Series Commands Performs Following Tasks Assume Ba Q37170621

1. Give the command (single command or pipelined series ofcommands) that performs each of the followingtasks.  Assume bash, and the commands we have beendiscussing.  Do not use things like perl, awk, python,etc.  Unless specifically stated otherwise, assume thatthe command should work no matter what your current workingdirectory is or where a user’s home directory is located. Use onlyflags that are required by the question as stated. Assume you arelogged in as a “normal” (non-administrator) user, but that you have”administrative” permissions set up in the sudoers file in case youwould be required to take advantage of that in order to carry outany of these tasks. Use only single spaces between parts of acommand/options/arguments, and do not put extra spaces before orafter the answers.

q) Sort the data that comes from a long file listing (“ls -l”and no other flags) by file size (and secondarily by file name) andstore the date/time and filename that the largest file was lastupdated into a variable called ALL. For example, if the file hasbeen changed recently, the results should follow the formatillustrated in this example (not including the quotation marks):”Oct 20 06:56 sampleFile2”. If the file had not been changedrecently, the results might look like this: “Jan 11 2014sampleFile1”.

r) Extract the file name from the ALL variable (see earlierquestion Q) and store it into a variable called F_NM.

s) Extract the file month from the ALL variable (see earlierquestion Q) and store it into a variable called F_MO.

t) Extract file day from the ALL variable (see earlier questionQ) and store it into a variable called F_DY.

u) Extract file time (or year, if the file is older – the timeor year will be in the same column no matter which informationshows) from the ALL variable (see earlier question Q) and storethem into a variable called F_TM_YR.

v) Display a message using the four pieces of informationextracted from the ALL variable (see earlier questions Q, R, S, T,& U) and display a message that reads something like “’lastlog’is the largest file; it was last changed ‘Feb 03, 2015’”, or“’lastlog’ is the largest file; it was last changed ‘Nov 03,14:15:25’”, depending on whether it was updated recently or not.(If it is a recently updated file, it will show the time; if notrecently updated it will show the year.) Of course, it shoulddisplay information about whatever the largest file is when thecommand is run, not just the information illustrated here. Noticethe short version of the month name, and the zero-prefixed daynumber, and the 24-hour time format display.

Expert Answer


Answer to 1. Give the command (single command or pipelined series of commands) that performs each of the following tasks. Assume b… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *