02-11-2010
can we use awk/sed to achieve this ??
---------- Post updated at 05:43 PM ---------- Previous update was at 03:52 PM ----------
Quote:
Originally Posted by
jim mcnamara
Basically you need to convert the date to Julian Days for a date range or convert date/time to epoch seconds. You can do everything with epoch seconds, even though it is a tad longer. I use seconds.
Do you have perl or do you need a C example? You can do Julian Day arithmetic in shell, but that doesn't solve the date/time issue.
Will the following pseudocode work ?
Quote:
start_epoch <= epoch(start date&time)
end_epoch <= epoch(end date&time)
mytimestamp <= get timestamp in file
mytimestamp_epoch <= epoch(mytimestamp)
if (mytimestamp_epoch >=start_epoch && mytimestamp_epoch <=end_epoch)
then
keep the file
end if
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
:confused: I'm not really sure about the default backup date & time in our Unix system and I would like to change it to a convienient time...how do I do that? Please help? (1 Reply)
Discussion started by: EbeyeJJ
1 Replies
2. Shell Programming and Scripting
Hi guys,
I know that this topic has been discuss numerous times, and I have search the net and this forum for it.
However, non able to address the problem I faced so far.
I am on Solaris Platform and unable to install additional packages like the GNU date and gawk to make use of their... (5 Replies)
Discussion started by: DrivesMeCrazy
5 Replies
3. Shell Programming and Scripting
Hello All,
I was having a look on threads on the Forum about time calculation but didn't find exactly this issue.
For instance, if we have these 2 dates, begin & end :
20100430235830
20100501000200
Is there anyway, awk, ksh, perl to calculate the difference in sec and get for... (6 Replies)
Discussion started by: rany1
6 Replies
4. Shell Programming and Scripting
Hi Expert,
Need your scripting and finding data so that it help me to find the culprit of this memory usage error.
Data provided here is a sample.
Process Snapshot directory: /var/spool/processes-snapshot
webdev9o9% pwd
/var/spool/processes-snapshot
webdev9o9% ls -lrct
-rw-r--r-- ... (3 Replies)
Discussion started by: regmaster
3 Replies
5. Shell Programming and Scripting
Hello
does anyone know of an awk that will extract log file entries between a specific date and time range, eg:
awk '/15\/Dec\/2010:16:10:00/, /15\/Dec\/2010:16:15:00/' access_log
but one that works?
Or a free command line log file analysis tool/script?
I'd like to be able to view... (2 Replies)
Discussion started by: competitions
2 Replies
6. Programming
Can we select the datetime from oracle database in “hhmmssnnnccyymmdd” format ?
please help to solve this..... (2 Replies)
Discussion started by: Sanal
2 Replies
7. Shell Programming and Scripting
Hi Guys,
Can someone please help me on adding/inserting a variable date to an sql scipt? Basically I want to assign a 7 days date range. As shown below..
#!/usr/bin/perl
use strict;
use Env qw(ORACLE_HOME);
my $SQLPLUS='/opt/oracle/product/10.1.0/db_1/bin/sqlplus -S... (1 Reply)
Discussion started by: pinpe
1 Replies
8. UNIX Desktop Questions & Answers
how can i grep a range?
i have a text file with the following text:
result.log.00:2012/01/02 12:00:07.422 LOG STARTED HERE
N6Kashya29MemoryShieldScheduler_AO_IMPLE, pid=8662/8658,
config=(alertThreshold=10,alertLevel=0,killThreshold=7200,coreThreshold=0,full=1),
deltaTime=0,... (1 Reply)
Discussion started by: boaz733
1 Replies
9. Shell Programming and Scripting
i need to run one script inside of other, and there is some terms
- main script in scheduled in cron for everyday runing every 5min
- i need to run /tmp/script2.sh after first 3 days in month
- i need to run /tmp/script2.sh from 7-9AM, main script is runining all day
all recommendations are... (1 Reply)
Discussion started by: waso
1 Replies
10. Shell Programming and Scripting
Hi, im trying to write a grep script that returns me the last inputs added in the last hour in the log file. Literally i have nothing yet but:
grep 'Line im looking for' LOGFILE.log | tail -1
this only gives me the last input, but no necessarily from the last hour.
Help Please. (4 Replies)
Discussion started by: blacksteel1988
4 Replies
LEARN ABOUT DEBIAN
notmuch-search-terms
NOTMUCH-SEARCH-TERMS(7) Miscellaneous Information Manual NOTMUCH-SEARCH-TERMS(7)
NAME
notmuch-search-terms - Syntax for notmuch queries
SYNOPSIS
notmuch count [options...] <search-term>...
notmuch dump [ <filename> ] [--] [ <search-term>...]
notmuch search [options...] <search-term>...
notmuch show [options...] <search-term>...
notmuch tag +<tag>|-<tag> [...] [--] <search-term>...
DESCRIPTION
Several notmuch commands accept a common syntax for search terms.
The search terms can consist of free-form text (and quoted phrases) which will match all messages that contain all of the given
terms/phrases in the body, the subject, or any of the sender or recipient headers.
As a special case, a search string consisting of exactly a single asterisk ("*") will match all messages.
In addition to free text, the following prefixes can be used to force terms to match against specific portions of an email, (where <brack-
ets> indicate user-supplied values):
from:<name-or-address>
to:<name-or-address>
subject:<word-or-quoted-phrase>
attachment:<word>
tag:<tag> (or is:<tag>)
id:<message-id>
thread:<thread-id>
folder:<directory-path>
The from: prefix is used to match the name or address of the sender of an email message.
The to: prefix is used to match the names or addresses of any recipient of an email message, (whether To, Cc, or Bcc).
Any term prefixed with subject: will match only text from the subject of an email. Searching for a phrase in the subject is supported by
including quotation marks around the phrase, immediately following subject:.
The attachment: prefix can be used to search for specific filenames (or extensions) of attachments to email messages.
For tag: and is: valid tag values include inbox and unread by default for new messages added by notmuch new as well as any other tag values
added manually with notmuch tag.
For id:, message ID values are the literal contents of the Message-ID: header of email messages, but without the '<', '>' delimiters.
The thread: prefix can be used with the thread ID values that are generated internally by notmuch (and do not appear in email messages).
These thread ID values can be seen in the first column of output from notmuch search
The folder: prefix can be used to search for email message files that are contained within particular directories within the mail store.
Only the directory components below the top-level mail database path are available to be searched.
In addition to individual terms, multiple terms can be combined with Boolean operators ( and, or, not , etc.). Each term in the query will
be implicitly connected by a logical AND if no explicit operator is provided, (except that terms with a common prefix will be implicitly
combined with OR until we get Xapian defect #402 fixed).
Parentheses can also be used to control the combination of the Boolean operators, but will have to be protected from interpretation by the
shell, (such as by putting quotation marks around any parenthesized expression).
Finally, results can be restricted to only messages within a particular time range, (based on the Date: header) with a syntax of:
<initial-timestamp>..<final-timestamp>
Each timestamp is a number representing the number of seconds since 1970-01-01 00:00:00 UTC. This is not the most convenient means of
expressing date ranges, but until notmuch is fixed to accept a more convenient form, one can use the date program to construct timestamps.
For example, with the bash shell the following syntax would specify a date range to return messages from 2009-10-01 until the current time:
$(date +%s -d 2009-10-01)..$(date +%s)
SEE ALSO
notmuch(1), notmuch-config(1), notmuch-count(1), notmuch-dump(1), notmuch-hooks(5), notmuch-new(1), notmuch-reply(1), notmuch-restore(1),
notmuch-search(1), notmuch-show(1), notmuch-tag(1)
Notmuch 0.13.2 2012-06-01 NOTMUCH-SEARCH-TERMS(7)