ls command question
I'm writing a scripts that requires the names and dates of files within a directory.
I could do ls -l to get this information but it also has the owner and rights that I don't need. I thought I could pipe the ls command with a cut command to only get the date and the filename but I can't get it to work. Does anyone have any suggestions? Thanks. |
Have a closer look at awk ...
Cut, btw, should be just fine... what's the problem? Cheers, Tink |
I don't know how to use cut. I assume its in the form
ls -l | cut. but I don't know what options I need to pass to get the last two columns. |
Heh ... have you tried a
man cut? :) But really, since cut's delimiter handling is a bit unwieldy I'd suggest using awk ... try ls -l | awk '{printf "%2d %3s %s\n", $7, $6, $9}' Cheers, Tink |
thanks that makes worked. I tried using cut with the ' ' delimiter but it wasn't working well. awk is easier. J
|
All times are GMT -5. The time now is 11:37 PM. |