hitesh_ofdoon has asked for the wisdom of the Perl Monks concerning the following question:
I want to pipe output of find UNIX command to perl to get atime for the files. I am not sure I am not getting it. The following correctly gives atime:
/sasdata=>perl -e '$l=$ARGV[0]; @d=localtime ((stat($l))[8]);printf "% +4d%02d%02d %s\n",$d[5]+1900,$d[4]+1,$d[3],$l' mhugo01 20090824 mhugo01
But the following does not:
/sasdata=>find /sasdata/it/development/sasmonitoring/code -type f |per +l \ hsharm01@sasbsp20> -e 'while (<>) {$l=$_;@d=localtime((stat($l))[8]);p +rintf "%4d%02d%02d %s",$d[5]+1900,$d[4]+1,$d[3],$l}' 19691231 /sasdata/it/development/sasmonitoring/code/growthmonitor.sas 19691231 /sasdata/it/development/sasmonitoring/code/growthmonitor.sh
Both are doing stat on the variable l and l has correct value in both.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: stat on find output
by kennethk (Abbot) on Oct 19, 2009 at 21:09 UTC | |
by hitesh_ofdoon (Initiate) on Oct 19, 2009 at 21:49 UTC | |
|
Re: stat on find output
by jakobi (Pilgrim) on Oct 19, 2009 at 21:49 UTC | |
by hitesh_ofdoon (Initiate) on Oct 19, 2009 at 21:52 UTC | |
by BioLion (Curate) on Oct 20, 2009 at 09:58 UTC | |
|
Re: stat on find output
by zwon (Abbot) on Oct 19, 2009 at 21:02 UTC | |
by kennethk (Abbot) on Oct 19, 2009 at 21:35 UTC |