Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Perl Command line for stat

Reply
Thread Tools

Perl Command line for stat

 
 
nos
Guest
Posts: n/a
 
      10-07-2003
I am trying to use a command line Perl e to stat a file with in
Solaris. I was looking for someone that can modify the line so it
will work from a command line. I have not been able to figure out the
right format to use. Can someone please help me with this.

Perl e (stat($filename)) [10]' any suggestions
 
Reply With Quote
 
 
 
 
Thens
Guest
Posts: n/a
 
      10-07-2003
On 7 Oct 2003 10:52:23 -0700
http://www.velocityreviews.com/forums/(E-Mail Removed) (nos) wrote:

# I am trying to use a command line Perl _e to stat a file with in
# Solaris. I was looking for someone that can modify the line so it
# will work from a command line. I have not been able to figure out the
# right format to use. Can someone please help me with this.
#
# Perl _e _(stat($filename)) [10]' any suggestions

perl -e 'print [stat $ARGV[0]]->[10]' <filename>

is what you want.

perldoc perlrun for more information.


Regards,
Thens.
 
Reply With Quote
 
 
 
 
Tad McClellan
Guest
Posts: n/a
 
      10-07-2003
nos <(E-Mail Removed)> wrote:
> I am trying to use a command line Perl e to stat a file with in
> Solaris. I was looking for someone that can modify the line so it
> will work from a command line. I have not been able to figure out the
> right format to use. Can someone please help me with this.
>
> Perl e (stat($filename)) [10]' any suggestions



perl -le 'print( (stat shift)[10] )' file
or
perl -le 'print +(stat shift)[10]' file


--
Tad McClellan SGML consulting
(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
Michele Dondi
Guest
Posts: n/a
 
      10-09-2003
On Tue, 7 Oct 2003 23:57:13 +0530, Thens <(E-Mail Removed)> wrote:

>On 7 Oct 2003 10:52:23 -0700
>(E-Mail Removed) (nos) wrote:
>
># I am trying to use a command line Perl _e to stat a file with in
># Solaris. I was looking for someone that can modify the line so it
># will work from a command line. I have not been able to figure out the
># right format to use. Can someone please help me with this.
>#
># Perl _e _(stat($filename)) [10]' any suggestions
>
>perl -e 'print [stat $ARGV[0]]->[10]' <filename>


perl -le 'print +(stat shift)[10]' <filename>

or slightly more generic,

perl -le 'print for map +(stat)[10], @ARGV' <filename(s)>

but then maybe better something along the lines of

perl -le 'print for map "$_\t".(stat)[10], @ARGV' <filename(s)>

In any case displaying (stat)[10] sounds strange IMHO: isn't it that
what the OP really wants is something of the kind of

perl -le 'print scalar localtime +(stat shift)[10]' <filename>


Michele
--
# This prints: Just another Perl hacker,
seek DATA,15,0 and print q... <DATA>;
__END__
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
os.stat() distorts filenames that end with period (nt.stat()) ruck Python 10 09-07-2012 05:54 AM
Why do I have to prefix stat from <sys/stat.h> with the keyword struct? Rolf Krüger C++ 2 03-12-2008 10:38 PM
Date & Time representation in "struct stat" - <sys/stat.h> Magesh C Programming 3 10-05-2007 12:13 PM
struct stat st; stat(fileName.c_str(), &st); hu? Steven T. Hatton C++ 3 06-02-2005 01:50 PM
os.stat('<filename>')[stat.ST_INO] on Windows Patrick Useldinger Python 6 03-03-2005 09:21 AM



Advertisments