but your code doesnt suit my requirement.In your code, you mentioned time as a variable.
But if you look into my below data...time is not a variable. It is just a text inside the data.
for better understanding ...
the above mentioned data is stored in a variable say $data.
Now I need to search for the aug month. If the data contains aug then I need to store ONLY the "Tue Aug 7 03:54:12 2012" into a separate variable.
Hi
I'm trying to find a way to search a text file for a specific string.
I have a file which contains i.p. addresses and port numbers in the following format:
'ip="www.xxx.yyy.zzz"'
'port="xx""'
I want to print only the parts between the double quotes for use in seperate variables,... (4 Replies)
hi
this is an example of code:
use strict;
use warnings;
open FILE, "/tmp/result_2";
my $regex="\\ Starting program ver. (.*)";
my $res="Program started, version <$1> - OK.\n";
while (<FILE>) {
if ($_ =~ /($regex)/) {
print "$res";
}
}
close FILE;
This finds $regex and print... (3 Replies)
Suppose there are two arrays of arrays:
@A = ( , , , );
@B = ( , , , , );
For each of $A, $A, $A..., I want to find the corresponding one in @B (match the letter, like $A eq $B), and print out both the second item, for example, $A and $B.
How can I do this in perl? grep + map? Hope I... (1 Reply)
Hi All,
I want to find the time diffrence between currnt time and "abc.txt" file create time.
I have solve that but if the abc.txt file created last month then is there any process to find the difftent?
Exp:
Create time of abc.txt is "Apr 14 06:48"
and currect date is "May 17 23:47".... (1 Reply)
Hi, How to create array every time user input and store user input and display all array
print " Enter input "
my @input = split(' ', $input)
chmop($input = <STDIN>;
foreach ($input)
{
@array= @input;
}
print @array"\n"; (1 Reply)
I have requirment to get last date of previous month and the first date of previous 4th month:
Example:
Current date: 20130320 (yyyymmdd)
Last date of previous month: 20130228 (yyyymmdd)
First date of previous 4th month: 20121101 (yyyymmdd)
In my shell --date, -d, -v switches are not... (3 Replies)
Hi
I am trying to store the output of a command into an array in perl script.
I am able to store but the problem is i am unable to print the array line with one line space. i mean i inserted the \n in loop ...but not getting the result.
I have written like this
#!/usr/bin/perl
@a =... (2 Replies)
Hello,
i`m looking for some way to add to some date an partial number of months, for example to 2015y 02m 27d + 2,54m
i need to write this script in php or bash or sh or mysql or perl in normal time o unix time
i`m asking or there are any simple way to add partial number of month to some... (14 Replies)
Discussion started by: bacarrdy
14 Replies
LEARN ABOUT ULTRIX
strftime
strftime(3) Library Functions Manual strftime(3)Name
strftime - convert time and date to string
Syntax
#include <time.h>
int strftime (s, maxsize, format, tm)
char *s;
size_t maxsize;
char *format;
struct tm *tm;
Description
The function places characters in the array pointed to by s. No more than maxsize characters are placed into the array. The string con-
trols this process. This string consists of zero or more directives and ordinary characters. A directive consists of a character followed
by a character that determines the behavior of the directive. All ordinary characters are copied unchanged into the array, including the
terminating null character.
Each directive is replaced by the appropriate characters as shown in the following table. The characters are determined by the program's
locale category and the values contained in the structure pointed to by tm.
-------------------------------------------------------------
Directive Replaced by
-------------------------------------------------------------
%a Locale's abbreviated weekday name
%A Locale's full weekday name
%b Locale's abbreviated month name
%B Locale's full month name
%c Locale's date and time representation
%d Day of month as a decimal number (01-31)
%D Date (%m/%d/%y)
%h Locale's abbreviated month name
%H Hour as a decimal number (00-23)
%I Hour as a decimal number (01-12)
%j Day of year (001-366)
%m Number of month (01-12)
%M Minute number (00-59)
%n Newline character
%p Locale's equivalent to AM or PM
%r Time in AM/PM notation
%S Second number (00-59)
%t Tab character
%T Time (%H/%M/%S)
%U Week number (00-53), Sunday as first day of week
%w Weekday number (0[Sunday]-6)
%W Week number (00-53), Monday as first day of week
%x Locale's date representation
%X Locale's time representation
%y Year without century (00-99)
%Y Year with century
%Z Timezone name, no characters if no timezone
%% %
-------------------------------------------------------------
If a directive is used that is not contained in the table, the results are undefined.
International Environment
LC_TIME Contains the user's requirements for language, territory, and codeset for the time format. affects the behavior of the time
functions in If is not defined in the current environment, provides the necessary default.
LANG If this environment is set and valid, uses the international language database named in the definition to determine the time
formatting rules. If is defined, its definition supercedes the definition of
Return Values
If the total number of resulting characters, including the terminal null character, is not more than maxsize, the function returns the
total of resultant characters placed into the array pointed to by s, not including the terminating null character. In all other cases zero
is returned and the contents of the array are indeterminate.
As the name is not contained in the tm structure the value returned by %Z is determined by the function, see
See Alsoctime(3), setlocale(3)strftime(3)