mutt/search-by-date
author Tomas Zeman <tzeman@volny.cz>
Thu, 17 Sep 2015 07:24:39 +0200
changeset 40 eace2739e6b8
permissions -rw-r--r--
mutt/search-by-date
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
40
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
     1
http://promberger.info/linux/2009/07/23/mutt-limit-or-search-by-date/
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
     2
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
     3
The following will not work:
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
     4
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
     5
~d < 1w
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
     6
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
     7
Use this instead:
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
     8
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
     9
~d <1w
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    10
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    11
Also, remember mutt uses the "AND" operator by default, so do not add & or &&
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    12
to combine searches using AND. Instead, just string them together. Say you want
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    13
to see all mail to, from, or cc a specific address group, sent in the last
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    14
seven days, do l for limit, or / for search, followed by:
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    15
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    16
%L groupname ~d <1w
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    17
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    18
Addendum
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    19
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    20
It seems you cannot, by the way, combine the relational < or > searches with an
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    21
absolute date. You can, however, add an error margin to an absolute date,
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    22
usually achieving what you want to do. The error margin can be before (-),
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    23
after (+), or both, using *. Like this:
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    24
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    25
Up to one month before date:
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    26
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    27
~d 30/10/08-1m
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    28
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    29
Up to five days after this date of the current year:
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    30
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    31
~d 04/05+5d
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    32
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    33
One week before and after date:
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    34
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    35
~d 27/02/2009*1w
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    36
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    37
------------------------------------------------------------
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    38
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    39
http://www.mutt.org/doc/devel/manual.html#date-patterns
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    40
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    41
3.4. Searching by Date
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    42
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    43
Mutt supports two types of dates, absolute and relative.
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    44
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    45
3.4.1. Absolute Dates
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    46
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    47
Dates must be in DD/MM/YY format (month and year are optional, defaulting to
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    48
the current month and year). An example of a valid range of dates is:
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    49
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    50
Limit to messages matching: ~d 20/1/95-31/10
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    51
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    52
If you omit the minimum (first) date, and just specify “-DD/MM/YY”, all
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    53
messages before the given date will be selected. If you omit the maximum
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    54
(second) date, and specify “DD/MM/YY-”, all messages after the given date will
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    55
be selected. If you specify a single date with no dash (“-”), only messages
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    56
sent on the given date will be selected.
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    57
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    58
You can add error margins to absolute dates. An error margin is a sign (+ or
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    59
-), followed by a digit, followed by one of the units in Table 4.6, “Date
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    60
units”. As a special case, you can replace the sign by a “*” character, which
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    61
is equivalent to giving identical plus and minus error margins.
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    62
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    63
Table 4.6. Date units
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    64
Unit	Description
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    65
y	Years
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    66
m	Months
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    67
w	Weeks
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    68
d	Days
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    69
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    70
Example: To select any messages two weeks around January 15, 2001, you'd use
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    71
the following pattern:
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    72
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    73
Limit to messages matching: ~d 15/1/2001*2w
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    74
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    75
3.4.2. Relative Dates
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    76
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    77
This type of date is relative to the current date, and may be specified as:
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    78
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    79
    >offset for messages older than offset units
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    80
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    81
    <offset for messages newer than offset units
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    82
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    83
    =offset for messages exactly offset units old 
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    84
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    85
offset is specified as a positive number with one of the units from Table 4.6,
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    86
“Date units”.
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    87
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    88
Example: to select messages less than 1 month old, you would use
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    89
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    90
Limit to messages matching: ~d <1m
eace2739e6b8 mutt/search-by-date
Tomas Zeman <tzeman@volny.cz>
parents:
diff changeset
    91