From: Atropo on 31 Dec 2009 08:49 Hi all, I searched similar post about, but some of them i didn't understand and the others were about file name manipulation. what i want is just list the files of an specific hour (any minute) from specific date. i stuck with the hour part. ls -l | awk ' if (($6=="Dec") && ($7=="29") && ( $8 ~ /08/ )) {print $0}' /usr/bin/awk on solaris 9 the last time it worked was ls -l | awk ' $6=="Dec" && $7=="29" {print $0}'
From: mop2 on 31 Dec 2009 09:04 On Thu, 31 Dec 2009 11:49:47 -0200, Atropo <lxvasquez(a)gmail.com> wrote: > Hi all, > > I searched similar post about, but some of them i didn't understand > and the others were about file name manipulation. what i want is just > list the files of an specific hour (any minute) from specific date. > i stuck with the hour part. > > ls -l | awk ' if (($6=="Dec") && ($7=="29") && ( $8 ~ /08/ )) {print > $0}' > > /usr/bin/awk on solaris 9 > > the last time it worked was > > ls -l | awk ' $6=="Dec" && $7=="29" {print $0}' > Well, without awk, but is easy to undertand: $ \ls -l|grep '2009-12-29 11' drwxr-xr-x 5 web ppp 4096 2009-12-29 11:55 gtkdialog-0.7.20 -rw-r--r-- 1 web ppp 280408 2009-12-29 11:54 gtkdialog-0.7.20.tar.gz drwx------ 5 web ppp 4096 2009-12-29 11:40 yaf-splash-1.02 -rw-r--r-- 1 web ppp 81391 2009-12-29 11:30 yaf-splash-1.02.tar.gz $ \ls -l|grep '2009-12-29 11'|tr -s ' '|cut -d' ' -f8- gtkdialog-0.7.20 gtkdialog-0.7.20.tar.gz yaf-splash-1.02 yaf-splash-1.02.tar.gz
From: Ed Morton on 31 Dec 2009 09:09 On 12/31/2009 7:49 AM, Atropo wrote: > Hi all, > > I searched similar post about, but some of them i didn't understand > and the others were about file name manipulation. what i want is just > list the files of an specific hour (any minute) from specific date. > i stuck with the hour part. > > ls -l | awk ' if (($6=="Dec")&& ($7=="29")&& ( $8 ~ /08/ )) {print > $0}' > > /usr/bin/awk on solaris 9 That's "old, broken awk". Don't use it. Use GNU awk (gawk), New awk (nawk), or /usr/xpg4/bin/awk on Solaris. > the last time it worked was > > ls -l | awk ' $6=="Dec"&& $7=="29" {print $0}' You could do it that way with: ls -l | awk '$6=="Dec" && $7=="29" && $8 ~ /^08/' but that wouldn't work for older files whose ls -l output is in "month day year" format rather than "month day time" format so you'd get a more robust solution using "find -maxdepth 1" with "-mtime" or "-newer" options. man find for details. Ed.
From: Atropo on 31 Dec 2009 09:10 On 31 dic, 10:04, mop2 <inva...(a)mail.address> wrote: > On Thu, 31 Dec 2009 11:49:47 -0200, Atropo <lxvasq...(a)gmail.com> wrote: > > Hi all, > > > I searched similar post about, but some of them i didn't understand > > and the others were about file name manipulation. what i want is just > > list the files of an specific hour (any minute) from specific date. > > i stuck with the hour part. > > > ls -l | awk ' if (($6=="Dec") && ($7=="29") && ( $8 ~ /08/ )) {print > > $0}' > > > /usr/bin/awk on solaris 9 > > > the last time it worked was > > > ls -l | awk ' $6=="Dec" && $7=="29" {print $0}' > > Well, without awk, but is easy to undertand: > > $ \ls -l|grep '2009-12-29 11' > drwxr-xr-x 5 web ppp 4096 2009-12-29 11:55 gtkdialog-0.7.20 > -rw-r--r-- 1 web ppp 280408 2009-12-29 11:54 gtkdialog-0.7.20.tar.gz > drwx------ 5 web ppp 4096 2009-12-29 11:40 yaf-splash-1.02 > -rw-r--r-- 1 web ppp 81391 2009-12-29 11:30 yaf-splash-1.02.tar.gz > > $ \ls -l|grep '2009-12-29 11'|tr -s ' '|cut -d' ' -f8- > gtkdialog-0.7.20 > gtkdialog-0.7.20.tar.gz > yaf-splash-1.02 > yaf-splash-1.02.tar.gz absolutely right. sometimes you keep spinnin' on the same error, just because you figure out first
From: Atropo on 31 Dec 2009 09:19 On 31 dic, 10:09, Ed Morton <mortons...(a)gmail.com> wrote: > On 12/31/2009 7:49 AM, Atropo wrote: > > > Hi all, > > > I searched similar post about, but some of them i didn't understand > > and the others were about file name manipulation. what i want is just > > list the files of an specific hour (any minute) from specific date. > > i stuck with the hour part. > > > ls -l | awk ' if (($6=="Dec")&& ($7=="29")&& ( $8 ~ /08/ )) {print > > $0}' > > > /usr/bin/awk on solaris 9 > > That's "old, broken awk". Don't use it. Use GNU awk (gawk), New awk (nawk), or > /usr/xpg4/bin/awk on Solaris. > > > the last time it worked was > > > ls -l | awk ' $6=="Dec"&& $7=="29" {print $0}' > > You could do it that way with: > > ls -l | awk '$6=="Dec" && $7=="29" && $8 ~ /^08/' > > but that wouldn't work for older files whose ls -l output is in "month day year" > format rather than "month day time" format so you'd get a more robust solution > using "find -maxdepth 1" with "-mtime" or "-newer" options. man find for details. > > Ed. Thanks Ed. i was struggling with find first but their search was time relative..
|
Next
|
Last
Pages: 1 2 3 Prev: unzip | touch | re-zip Next: What's the point of using tar *for backup* today? |