Lots of ways to do it, easy if you have the Date::Manip perl module, but without you could put the following code in a file (make it executable). and run it with the input text file as the argument.
Assumes all lines are of the format in your original post and there are no leading spaces on the lines.
Im tyring to create a script that will show me any lines in a file with todays date and yesterdays, the date format in the file is as follows
----- amqxfdcx.c : 728 --------------------------------------------------------
07/12/05 09:53:20
AMQ6109: An internal WebSphere MQ error has... (3 Replies)
Hello friends,
I am looking for a script or method that can display all the dates between any 2 given dates.
Input:
Date 1
290109
Date 2
010209
Output:
300109
310109
Please help me. Thanks. :):confused: (2 Replies)
Don't know if it is important: Debian Linux / MySQL 5.1
I have a table:
media_id int(8)
group_id int(8)
type_id int(8)
expiration date
start date
cust_id int(8)
num_runs int(8)
preferred_time int(8)
edit_date timestamp ON UPDATE CURRENT_TIMESTAMP
id... (0 Replies)
Hi guys,
For my wiki site I need to fix 1400 pages that use the wrong date format, most pages (not all) use eg. 1988]] I need to change that to (1988)]]
The date range goes back to 1400 so I guess I need to do the following
ssh into my server,
dump mysql database
vi .sql dump
search... (20 Replies)
without using conventional file searching commands like find etc, is it possible to locate a file if i just know that the file that i'm searching for contains a particular text like "Hello world" or something? (5 Replies)
Hi All,
I am trying to print the dates that falls between 2 date variables into a file. Here is the example.
$BUS_DATE =20120616
$SUB_DATE=20120613
Output to file abc.txt should be : 20120613,20120614,120120615,20120616
Can you pls help me accomplish this in LINUX.
Thanks... (5 Replies)
HI,
i have row like this
HHH100037440313438961000201001012012073110220002 N
in this i have 2 dates in pos 25-32 and 33-40 , so based upon the se two dates , i need to generated records between these two values
so in the above record 20100101 and 20120731
need to genearte rows like this... (4 Replies)
Hi Am Using Unix Ksh ...
I have a Table called date
select * from date ;
Date
01/02/2013
06/02/2013
I need the output as
Missing Date
01/02/2013
02/02/2013
03/02/2013
04/02/2013
05/02/2013
06/02/2013 (2 Replies)
Hi,
I am searching for some specific string in an Oracle DB alert log and then possibly print the latest date string that I can find that the error happen.
I can't work out how to search for date strings more so searching in some specific direction, i.e backward or forward.
At the moment,... (1 Reply)
Hi All,
I have 2 dates in mm/dd format.
sdate=10/01 (October 01)
edate=10/10 (October 10)
I need the dates in between these 2 dates like below.
10/01
10/02
10/03
10/04
10/05
10/06
10/07
10/08 (1 Reply)
Discussion started by: jayadanabalan
1 Replies
LEARN ABOUT DEBIAN
bsearch
BSEARCH(3) Linux Programmer's Manual BSEARCH(3)NAME
bsearch - binary search of a sorted array
SYNOPSIS
#include <stdlib.h>
void *bsearch(const void *key, const void *base,
size_t nmemb, size_t size,
int (*compar)(const void *, const void *));
DESCRIPTION
The bsearch() function searches an array of nmemb objects, the initial member of which is pointed to by base, for a member that matches the
object pointed to by key. The size of each member of the array is specified by size.
The contents of the array should be in ascending sorted order according to the comparison function referenced by compar. The compar rou-
tine is expected to have two arguments which point to the key object and to an array member, in that order, and should return an integer
less than, equal to, or greater than zero if the key object is found, respectively, to be less than, to match, or be greater than the array
member.
RETURN VALUE
The bsearch() function returns a pointer to a matching member of the array, or NULL if no match is found. If there are multiple elements
that match the key, the element returned is unspecified.
CONFORMING TO
SVr4, 4.3BSD, POSIX.1-2001, C89, C99.
EXAMPLE
The example below first sorts an array of structures using qsort(3), then retrieves desired elements using bsearch().
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct mi {
int nr;
char *name;
} months[] = {
{ 1, "jan" }, { 2, "feb" }, { 3, "mar" }, { 4, "apr" },
{ 5, "may" }, { 6, "jun" }, { 7, "jul" }, { 8, "aug" },
{ 9, "sep" }, {10, "oct" }, {11, "nov" }, {12, "dec" }
};
#define nr_of_months (sizeof(months)/sizeof(months[0]))
static int
compmi(const void *m1, const void *m2)
{
struct mi *mi1 = (struct mi *) m1;
struct mi *mi2 = (struct mi *) m2;
return strcmp(mi1->name, mi2->name);
}
int
main(int argc, char **argv)
{
int i;
qsort(months, nr_of_months, sizeof(struct mi), compmi);
for (i = 1; i < argc; i++) {
struct mi key, *res;
key.name = argv[i];
res = bsearch(&key, months, nr_of_months,
sizeof(struct mi), compmi);
if (res == NULL)
printf("'%s': unknown month
", argv[i]);
else
printf("%s: month #%d
", res->name, res->nr);
}
exit(EXIT_SUCCESS);
}
SEE ALSO hsearch(3), lsearch(3), qsort(3), tsearch(3)COLOPHON
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
2003-11-01 BSEARCH(3)