Hi,
Please help in this regard.
Can the modification time of a file be updated to any date of our choice?
Please advise.
Thanks in advance!
Hi,
Please help in this regard.
Can the modification time of a file be updated to any date of our choice?
Please advise.
Thanks in advance!
Jump to PostHi,
Please help in this regard.Can the modification time of a file be updated to any date of our choice?
Please advise.
Thanks in advance!
Look into the command
touch
Jump to PostYes it will. Why don't you try showing us what you tried.
P.S. Did you try typing "man touch" first?
Jump to Posttouch -m 20091114113000 f1.sh
touch -mt 200911141130.00 f1.sh
Take a closer look at the man page.
Jump to Post[...]
I just/only want the modification date.?[...]
i cant use 'ls' cmd, this displays all fields
[...]As you have been shown you can pipe the ls command to another program that further parses the output, in this case awk.
awk can do a lot of things, but even in …
Hi,
Please help in this regard.Can the modification time of a file be updated to any date of our choice?
Please advise.
Thanks in advance!
Look into the command touch
Yes Aia , I checked on 'touch' cmd . but it does not work , i think it wont work in cshell? pl confirm..
Yes it will. Why don't you try showing us what you tried.
P.S. Did you try typing "man touch" first?
Hi All,
I used this, but its updating the modfication time to current time.
touch -m 20091114113000 f1.sh
where.. date is 14th nov 2009 & time is 11:30:00
[[CC]YY]MMDDhhmm[.SS]
where each two digits represents the following:
MM
The month of the year [01-12].
DD
The day of the month [01-31].
hh
The hour of the day [00-23].
mm
The minute of the hour [00-59].
CC
The first two digits of the year (the century).
YY
The second two digits of the year.
SS
The second of the minute [00-61].
My another question is ...
How do we get the modification date of a file.?
I just/only want the modification date.?
i cant use 'ls' cmd, this displays all fields
Please help!
Thanks
touch -m 20091114113000 f1.sh
touch -mt 200911141130.00 f1.sh
Take a closer look at the man page.
My another question is ...
How do we get the modification date of a file.?
I just/only want the modification date.?i cant use 'ls' cmd, this displays all fields
Please help!
Thanks
The man page for ls and the awk command.
-E The same as -l, except displays time to the nanosecond and with one format for all files regardless of age: yyyy-mm-dd hh:mm:ss.nnnnnnnnn (ISO 8601:2000 format). In addition, this option displays the offset from UTC in ISO 8601:2000 standard format (+hhmm or -hhmm) or no characters if the offset is indeterminable. The offset reflects the appropriate standard or alternate offset in force at the file's displayed date and time, under the current timezone.
ls -E f1.sh | awk '{print $6, $7, $8}'
[...]
I just/only want the modification date.?[...]
i cant use 'ls' cmd, this displays all fields
[...]
As you have been shown you can pipe the ls command to another program that further parses the output, in this case awk.
awk can do a lot of things, but even in its simplest form it can be very helpful dealing with strings. Considerate this:
ls -l | awk '{ print $8 " was modified on " $6 }'
Hi Masijade,
I used the cmd given by you , but its showing this & date isnt changing.
Please help
touch -mt 200911141130.00 f1.sh
usage: touch [-amcf] file ...
Hi All,
I have another question
Does \n not work in csh?
If not, then how do I get to put my text in a new line...
Please help
echo "${var} \n" >> ${MAIL_FILE}
Hi Masijade,
I used the cmd given by you , but its showing this & date isnt changing.Please help
touch -mt 200911141130.00 f1.sh usage: touch [-amcf] file ...
I didn't mention, that was on Solaris. On something else the "t" may not be necessary (and is seemingly not on your system), but that decimal point is (when including seconds).
Hi All,
I have another question
Does \n not work in csh?
If not, then how do I get to put my text in a new line...Please help
echo "${var} \n" >> ${MAIL_FILE}
There is a tutorial at the head of the scripting forum here. Read it.
All,
Thanks a lot.
One more question..
how do I get only the HOURS (no minutes) from the below code?
ls -l f3.sh | awk '{print $7}'
I just know that for getting current date HOURS, this is used
date '+%H'
Please help..........
Thanks in advance
If you want to continue using awk as the workhorse, then:
ls -l f3.sh | awk '{ if( NF > 7 ) { split($7, a, ":"); print a[1] } }'
# if( NF > 7 ) checks that there are more than seven fields
# split($7, a, ":") splits field seven into parts according to delimiter ":" and stores it into array a
# print a[1] displays part 1 which must be the hour
Hi Aia,
Thanks a lot.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.