If you have GNU coretuils installed, then there is a stat command (not a C system call) that works from the command line. Otherwise you have to resort to perl or C.
Currently date command is showing following output
(ibm)jhamay:/home/jhamay->date
Wed Dec 19 14:19:25 PAKST 2007
I want to change PAKST to IST. I have searched through man pages but didn't find any relevant things.could you all please help me out. (4 Replies)
Assume, I created one file three years back and I like to move the file to some other directory with the old date (Creation date)? Is it possible? Explain? (1 Reply)
I have a website. I have a directory within it with over a hundred .html files. I need to change a date within every file. I don't have an easy way to find/replace.
I need to change 10/31 to 11/30 on every single page at once. I tried the command below but it didn't work. Obviously I don't know... (3 Replies)
Dear All,
Please help !
i ham having 300 file with E.G. PMC1_4567.arc in seq. like PMC1_4568.arc,PMC1_4569.arc ...n and so on.. i want all those file to be rename like PMC_4567.arc ,PMC_4568.arc .. mean i want to remove 1 from first file name ..
pls help.. (6 Replies)
hi..
i am new to here. can anybody tell me how can we change the date format in the 'last' command.
EX- on running last command i am getting --
rruat pts/12 172.18.40.101 Tue May 3 12:59 still logged in
rruat pts/10 blr2-3f-239.asco Tue May 3 12:59 - 13:09 ... (2 Replies)
Hi all,
I want to check whether a file is not updated in last 15 minutes, for this i need to get timestamp of file, (yyyy:mm:dd:hh:mi:ss). I dont have access to STAT command :(.
Please suggest a program or command to do this .
Thanks,
Saravana (1 Reply)
Hi, I am extracting a date string from the source file like this :
06/05/2014 16:04:00
I want to change it to 05-JUN-14 04.05.00.000000000 PM
I basically store the date in a variable. I got solutions to change date in dd-mmm-yyyy format using tr but I guess it works only with the "date"... (8 Replies)
Hi,
I need help to convert the date format in .DAT file in unix.
I want to convert
10@@|SWIFT MT568 Extract@@|Apr 14 2014 5:47:52:563PM@@|Apr 14 2014 4:33:47:663PM@@||##|
into
10@@|SWIFT MT568 Extract@@|04/14/2014/ 5:47:52:563PM@@|04/14/2014 4:33:47:663PM@@||##|
Appreciate... (18 Replies)
Hi All,
I'm new to forum good to hear all.
I stuck in converting date format in csv file using unix
csv file contains as below
,750,0000000000000000GCJR, ,06/22/2016 14:48:44
I want to convert into as below
,750,0000000000000000GCJR, ,06/22/2016 02:48:44 PM
Please reply asap..... (22 Replies)
current date command runs well
awk -v t="$(date +%Y-%m-%d)" -F "'" '$1 < t' myname.dat
subtract 30 days fails
awk -v t="$(date --date="-30days" +%Y-%m-%d)" -F "'" '$1 < t' myname.dat
awk command in hp unix subtract 30 days automatically from current date without date illegal option error... (20 Replies)
Discussion started by: kmarcus
20 Replies
LEARN ABOUT REDHAT
file::stat
File::stat(3pm) Perl Programmers Reference Guide File::stat(3pm)NAME
File::stat - by-name interface to Perl's built-in stat() functions
SYNOPSIS
use File::stat;
$st = stat($file) or die "No $file: $!";
if ( ($st->mode & 0111) && $st->nlink > 1) ) {
print "$file is executable with lotsa links
";
}
use File::stat qw(:FIELDS);
stat($file) or die "No $file: $!";
if ( ($st_mode & 0111) && $st_nlink > 1) ) {
print "$file is executable with lotsa links
";
}
DESCRIPTION
This module's default exports override the core stat() and lstat() functions, replacing them with versions that return "File::stat"
objects. This object has methods that return the similarly named structure field name from the stat(2) function; namely, dev, ino, mode,
nlink, uid, gid, rdev, size, atime, mtime, ctime, blksize, and blocks.
You may also import all the structure fields directly into your namespace as regular variables using the :FIELDS import tag. (Note that
this still overrides your stat() and lstat() functions.) Access these fields as variables named with a preceding "st_" in front their
method names. Thus, "$stat_obj->dev()" corresponds to $st_dev if you import the fields.
To access this functionality without the core overrides, pass the "use" an empty import list, and then access function functions with their
full qualified names. On the other hand, the built-ins are still available via the "CORE::" pseudo-package.
BUGS
As of Perl 5.8.0 after using this module you cannot use the implicit $_ or the special filehandle "_" with stat() or lstat(), trying to do
so leads into strange errors. The workaround is for $_ to be explicit
my $stat_obj = stat $_;
and for "_" to explicitly populate the object using the unexported and undocumented populate() function with CORE::stat():
my $stat_obj = File::stat::populate(CORE::stat(_));
NOTE
While this class is currently implemented using the Class::Struct module to build a struct-like class, you shouldn't rely upon this.
AUTHOR
Tom Christiansen
perl v5.8.0 2002-06-01 File::stat(3pm)