I am looking for a way to find a date in the file without using find. for example something like this:
There are a number of files that have 5-28-2014.txt in the name, even one file that is named just 5-28-2014.txt, but I keep getting "no" when the script returns the value. Any ideas?
Also the YEST variable does contain 5-28-2014.txt, I echoed to check it
hello,
can anyone tell me how to rename a filename in a script to contain the current date?
i have searched for the answer but with little success!
many thanks
rkap (4 Replies)
I am a newbie in shell scripting and I need to produce a script to work and achieve the following:
1) Look into the file /etc/defaultrouter , and store the value in it
2) If the value is a number, go to LIST and print out the second column corresponding to the value.(eg London)
3) If the... (5 Replies)
Hi all
I have the following question:
With this command, I get the latest file in a directory.
lastfile =`ls -1tr | tail -n 1`
echo $lastfile
The output is then:
partner131210.txt (meaning 13th December 2010)
My goal is to get the date into a variable and to obtain a final variable... (4 Replies)
I am using ksh93 on Solaris.
Ok, this may seem like a simple request at first. I have a directory that contains sets of files with a YYYYMMDD component to the name, along with other files of different filespecs. something like this:
20110501_1.dat
20110501_2.dat
20110501_3.dat... (2 Replies)
Please help, I want script to check filename, size and date in specify path.
I want output as:
DATE: YYYYMMDD HH:MM
------------------------------------------------
fileA,filesize,yyyy mm dd HH:MM
fileA,filesize,yyyy mm dd HH:MM
fileA,filesize,yyyy mm dd HH:MM
fileA,filesize,yyyy mm dd... (1 Reply)
Hello,
We have a process on our Linux RedHat machine creating symbolic links and moving around some files from domain to domain. The issue is that the programmer has left a long time ago and nobody knows how the program is called, where it is and how the scheduling is setup. It runs every day for... (7 Replies)
Hello,
I'd like to write a monthly archive script that archives some logs. But I'd like to do it based on yesterday's date. In other words, I'd like to schedule the script to run on the 1st day of each month, but have the archive filename include the previous month instead.
Here's what I... (5 Replies)
Suppose i have a list of files in a directory as mentioned below
1. Shankar_04152019_ny.txt
2. Gopi_shan_03122019_mi.txt
3. Siva_mourya_02242019_nd.txt
..
.
.
.
.
1000 . Jiva_surya_02282019_nd.txt
query : At one shot i want to modify the above all filenames present in one path with... (4 Replies)
Discussion started by: Shankar455
4 Replies
LEARN ABOUT PHP
gmdate
GMDATE(3) 1 GMDATE(3)gmdate - Format a GMT/UTC date/time
SYNOPSIS
string gmdate (string $format, [int $timestamp = time()])
DESCRIPTION
Identical to the date(3) function except that the time returned is Greenwich Mean Time (GMT).
PARAMETERS
o $format
- The format of the outputted date string. See the formatting options for the date(3) function.
o $timestamp
- The optional $timestamp parameter is an integer Unix timestamp that defaults to the current local time if a $timestamp is not
given. In other words, it defaults to the value of time(3).
RETURN VALUES
Returns a formatted date string. If a non-numeric value is used for $timestamp, FALSE is returned and an E_WARNING level error is emitted.
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 5.1.0 | |
| | |
| | The valid range of a timestamp is typically from |
| | Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 |
| | 03:14:07 GMT. (These are the dates that corre- |
| | spond to the minimum and maximum values for a |
| | 32-bit signed integer). However, before PHP 5.1.0 |
| | this range was limited from 01-01-1970 to |
| | 19-01-2038 on some systems (e.g. Windows). |
| | |
| 5.1.1 | |
| | |
| | There are useful constants of standard date/time |
| | formats that can be used to specify the $format |
| | parameter. |
| | |
+--------+---------------------------------------------------+
EXAMPLES
Example #1
gmdate(3) example
When run in Finland (GMT +0200), the first line below prints "Jan 01 1998 00:00:00", while the second prints "Dec 31 1997
22:00:00".
<?php
echo date("M d Y H:i:s", mktime(0, 0, 0, 1, 1, 1998));
echo gmdate("M d Y H:i:s", mktime(0, 0, 0, 1, 1, 1998));
?>
SEE ALSO date(3), mktime(3), gmmktime(3), strftime(3).
PHP Documentation Group GMDATE(3)