Hi.
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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.