Sorting output with awk, and formatting it -


I have to format the output of ls -la to include the modified files in December I am trying and output them well, this is what they currently see:

 ls -la | Awk {'print $ 6, $ 7, $ 8, $ 9, $ 10'} | Grep "Dec." | | Sort-R | Head-5 Dec 4 20:15 Folder / 4 Dec 19:51 ./4 Dec 17:42 Folder \ John / 4 Dec 16:19 Homework \ MAT \ 08/4 December 16:05 folder \ Smith / 

etc. ..

How can I set something like "./" and "../" to do something like a regular expression,

How can I also do this for those folders except for the slash "\" in which they have spaces? Id wants to leave the slash at the end whether it is a shell command Possible Yam? Or would I have to use Pearl for modifications for testing? I want to have the time to stay as the date and time. Any help would be greatly appreciated!

The box is Linux and it is being done through SSH.

Edit:

What I have yet (thanks for this for Mark and GBN)

  LS-LF | Grep -vE '..? /? $ '| Awk '{for (i = 6; i & lt; = nf; i ++) printf ("% s", $ i); Printf ("\ n"); } '| Grep "Dec." | | Sort-R | Head-5  

Im just having a "one place" with "space" is having trouble in place. Thanks to all the help till this point!

You can use to do most of the work for you:

  Find - Mindpath 1-MaxPep 1-PRINTIFF "% TB% Td% TH:% TM% f \ n" | Grep "^ Dec" | Sort -r  

The root directory (..) is not included by default. -Mandapeth 1 is freed from the current directory (.). You can remove -maxdepth 1 to make it recursive, but to include the path with the filename, you % f to % p should be changed

This is the field in -printf :

  • % Tb - short month name
  • % Td -
  • % TM:% TM - hours and minutes
  • % f - filename

grep I line A match has been added for the beginning, so it will not match the file named "decimal", which was modified in November, and For Ahrn.


Comments

Popular posts from this blog

iphone - How do I make a UIPickerView in a UIActionSheet -

excel - Populate list via a bi-Condition -