I'm trying to format the output of ls -la
to only contain files modified in December and output them nicely, this is what they currently look like:
ls -la | awk {'print $6,$7,$8,$9,$10'} | grep "Dec" | sort -r | head -5 Dec 4 20:15 folder/ Dec 4 19:51 ./ Dec 4 17:42 Folder\ John/ Dec 4 16:19 Homework\ MAT\ 08/ Dec 4 16:05 Folder\ Smith/
etc..
How can I set up something like a regular expression to not include things like "./" and "../",
Also how can I omit the slash "\" for folders that have spaces in them. Id like to drop the slash at the end. Is this possible through a shell command? Or would I have to use Perl to make modifications to the test? I do want the date and time to remain as is. Any help would be greatly appreciated!
The box has linux and this is being done via SSH.
Edit:
Heres what I have so far (thanks to Mark and gbacon for this)
ls -laF | grep -vE ' ..?/?$' | awk '{ for (i=6; i<=NF; i++) printf("%s ", $i); printf("\n"); } ' | grep "Dec" | sort -r | head -5
Im just having trouble with replacing "\ " with just a space " ". Other than that Thanks for all the help upto this point!