Advanced Listserv – Search
You can use search commands to search a Listserv mailing list’s archives (if it has them) for messages that include certain keywords. This can be particularly useful for searching for the answer to a question. For example, if you are searching for the best way to steam asparagus, you might search a recipe mailing list for the keywords “best and way and steam and asparagus”. The command is of the form:
search <listname> <keyword>
You can search for multiple keywords using boolean logic, employing the AND and OR keywords:
search <listname> <keyword1> and (<keyword2> or <keyword3>)
You can narrow the search by date, to certain time periods, by sender, and by keywords present in the subject or sender fields, as described below:
- Starting at a given date:
- Example starting at a give date:
- Today’s messages only:
- In the last n days:
- Example — in last 14 days:
- Ending at a given date:
- Example from a given date:
- Subject or sender contains keyword:
where subject contains <keyword>
where sender contains <keyword>
from <date1>
from 97/04/15
from today
from today<-n>
from today-14
to <date2>
from 97/04/15
The subject and sender options can be combined with boolean logic using AND and OR operators. For example, a search for messages about “landing” that was sent anywhere from 97/04/15 to four weeks ago, by a sender whose name or email address contains the word “nasa” and with a subject containing “venus” or “mars”, is shown below:
search astro-list landing from 97/04/15 to today-28 where sender contains nasa and (subject contains venus or subject contains mars)
You can search for a phrase by including it in single quotes. (Using the usual trick for these sorts of things, search for a phrase that includes a single quote by typing two single quotes together, which will then be interpreted as a single quote.)
search astro-list ‘mars lander’
search astro-list ‘shuttle”s landing’
To search for words that are case sensitive, include them in double quotes:
search astro-list “ABC”
You need to use double quotes to search for any word that is also a list server command word, such as “from” or “*”.
Other advanced options are shown below:
- Excludes keyword:
does not contain <keyword>
- Phonetically similar, using the SOUNDEX mathematical sound algorithm for text:
sounds like <keyword>
Note that a search command must not have any carriage returns in it. If your search command is too long, and your email program automatically inserts carriage returns after 70 characters or so to create separate lines with a word wrap feature, then you may be able to turn the word wrap feature off in your email program before sending the email. Alternatively, you can add two slashes to the first line, separate the command into several short lines, and then put a comma at the end of all lines except the last one to tell the list server that these lines are all part of the same command:
// search astro-list landing from 97/04/15 to today-28,
where sender contains nasa and,
(subject contains venus or subject contains mars)
You can retrieve individual posts returned by search commands with the getpost command.