08-28-2008
If I understand the logic correctly, wouldn't it suffice to remember the B hits and rattle off one each time you see an A? This is basically a two-liner in Perl, I guess it could be done in awk as well but the lack of ordered arrays is a bit of a drag. (Or does "first up" in steps 3 and 5 mean the latest B before the current A? Then it's even easier, and doesn't require an array.)
Last edited by era; 08-28-2008 at 02:49 PM..
Reason: Clarification indicates it's the easy one
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I have a file that I need to be able to find a pattern match on a line, search that line for a text pattern, and replace that text.
An example of 4 lines in my file is:
1. MatchText_randomNumberOfText moreData ReplaceMe moreData
2. MatchText_randomNumberOfText moreData moreData... (4 Replies)
Discussion started by: Crypto
4 Replies
2. UNIX for Dummies Questions & Answers
i am very new to UNIX
plz help me in this scenario
i have two text files as below
file1.txt
name=Rajakumar.
Discipline=Electronics and communication.
Designation=software Engineer.
file2.txt
name=Kannan.
Discipline=Mechanical.
Designation=CADD Design Engineer.
... (6 Replies)
Discussion started by: kkraja
6 Replies
3. Shell Programming and Scripting
dear all
i want to read 5th no of line from last line of file.
kindly suggest me possible ways.
rgds
jaydeep (2 Replies)
Discussion started by: jaydeep_sadaria
2 Replies
4. Shell Programming and Scripting
Hi,
Please let me know how to find text and print text and its previous line. Please don't get irritated few days back I asked text and next line. I am using HP-UX 11.11
Thanks for your help. (6 Replies)
Discussion started by: kamranjalal
6 Replies
5. Shell Programming and Scripting
Hi I am brand new to programming, I dont know how to go about this task, or what language is best for this...If there is an easy solution in different languages, I would love to see them. I want to learn about the steps to take on this, so Please put in comments where code is used.
I believe in... (9 Replies)
Discussion started by: perlrookie
9 Replies
6. UNIX for Dummies Questions & Answers
Hi All,
I am sitting on HPUX. I want to change the exit into #exit, which appears into 3red line of code in shell scripting, wondering how shell script to be called up to perform action. I have following code in all files. Now, I need to find the text exit and replace into #exit.
#!/sbin/sh... (10 Replies)
Discussion started by: alok.behria
10 Replies
7. Shell Programming and Scripting
How to reverse search for a matched string in a file. Get line# of the first matched line. I am getting '2' into 'lineNum' variable.
But it feels like I am using too many commands. Is there a better more efficiant way to do this on Unix?
abc.log
aaaaaaaaaaaaa
bbbbbbbbbbbbb... (11 Replies)
Discussion started by: kchinnam
11 Replies
8. Shell Programming and Scripting
Unix box server version
***********
>uname -r
B.11.00
>echo $SHELL
/usr/bin/ksh
--> in this server, I have the path like /IMbuild/dev/im0serv1
---> in that directory I have the folders startup(.jsp files nearly 100 jsp's ) and scripts(contains .js files nearly 100 files) ... (9 Replies)
Discussion started by: pasam
9 Replies
9. Shell Programming and Scripting
Dear All
I am having a text file which is having more than 200 lines.
EX:
001010122 12000 BIB 12000 11200 1200003
001010122 2000 AND 12000 11200 1200003
001010122 12000 KVB 12000 11200 1200003
In the above file i want to search for string KVB... (5 Replies)
Discussion started by: suryanarayana
5 Replies
10. Shell Programming and Scripting
Hi guys,
I have a text file named file1.txt that is formatted like this:
001 , ID , 20000
002 , Name , Brandon
003 , Phone_Number , 616-234-1999
004 , SSNumber , 234-23-234
005 , Model , Toyota
007 , Engine ,V8
008 , GPS , OFF
and I have file2.txt formatted like this:
... (2 Replies)
Discussion started by: An0mander
2 Replies
LEARN ABOUT DEBIAN
notmuch-search
NOTMUCH-SEARCH(1) General Commands Manual NOTMUCH-SEARCH(1)
NAME
notmuch-search - Search for messages matching the given search terms.
SYNOPSIS
notmuch search [options...] <search-term>...
DESCRIPTION
Search for messages matching the given search terms, and display as results the threads containing the matched messages.
The output consists of one line per thread, giving a thread ID, the date of the newest (or oldest, depending on the sort option) matched
message in the thread, the number of matched messages and total messages in the thread, the names of all participants in the thread, and
the subject of the newest (or oldest) message.
See notmuch-search-terms(7) for details of the supported syntax for <search-terms>.
Supported options for search include
--format=(json|text)
Presents the results in either JSON or plain-text (default).
--output=(summary|threads|messages|files|tags)
summary
Output a summary of each thread with any message matching the search terms. The summary includes the thread ID, date, the num-
ber of messages in the thread (both the number matched and the total number), the authors of the thread and the subject.
threads
Output the thread IDs of all threads with any message matching the search terms, either one per line (--format=text) or as a
JSON array (--format=json).
messages
Output the message IDs of all messages matching the search terms, either one per line (--format=text) or as a JSON array
(--format=json).
files
Output the filenames of all messages matching the search terms, either one per line (--format=text) or as a JSON array (--for-
mat=json).
tags
Output all tags that appear on any message matching the search terms, either one per line (--format=text) or as a JSON array
(--format=json).
--sort=(newest-first|oldest-first)
This option can be used to present results in either chronological order (oldest-first) or reverse chronological order (new-
est-first).
Note: The thread order will be distinct between these two options (beyond being simply reversed). When sorting by oldest-first the
threads will be sorted by the oldest message in each thread, but when sorting by newest-first the threads will be sorted by the
newest message in each thread.
By default, results will be displayed in reverse chronological order, (that is, the newest results will be displayed first).
--offset=[-]N
Skip displaying the first N results. With the leading '-', start at the Nth result from the end.
--limit=N
Limit the number of displayed results to N.
--exclude=(true|false|flag)
Specify whether to omit messages matching search.tag_exclude from the search results (the default) or not. The extra option flag
only has an effect when --output=summary In this case all matching threads are returned but the "match count" is the number of
matching non-excluded messages in the thread.
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-terms(7), notmuch-show(1), notmuch-tag(1)
Notmuch 0.13.2 2012-06-01 NOTMUCH-SEARCH(1)