Sponsored Content
Top Forums Shell Programming and Scripting Grep with multiple instances of same pattern Post 302348968 by spywarebox on Sunday 30th of August 2009 02:37:57 PM
Old 08-30-2009
Grep with multiple instances of same pattern

Hi,

This is my text file I'm trying to Grep.

Apple Location Greenland Rdsds dsds fdfd ddsads http Received Return Immediately Received End

My Grep command:

grep only--matching 'Location.*Received'


Because the keyword Received appears twice, the Grep command will stop at the last one:
Location Greenland Rdsds dsds fdfd ddsads http Received Return Immediately Received

I want it to stop after the first one:
Location Greenland Rdsds dsds fdfd ddsads http Received


How is that possible?

Thanks
 

10 More Discussions You Might Find Interesting

1. Solaris

Multiple pattern on same line using grep

Hi, I would like to search multiple patterns on same line, i.e. all patterns must present on same line. Please suggest. Thanx (2 Replies)
Discussion started by: sanjay1979
2 Replies

2. Shell Programming and Scripting

Grep with multiple instances of same pattern

Hi, This is my text file I'm trying to Grep. Apple Location Greenland Rdsds dsds fdfd ddsads http Received Return Immediately Received End My Grep command: grep only--matching 'Location.*Received' e. Because the keyword Received appears twice, the Grep command will stop at the last... (0 Replies)
Discussion started by: spywarebox
0 Replies

3. Shell Programming and Scripting

How to grep multiple pattern from XML file

Hi Everyone pls if anyone can help me in writing a script or correcting it what I have done. I want to write a script to grep record number for all those record which have abc xyd cat dog in one of the field say VALUE, I have thousand of file in a dir and I want to search every file for... (6 Replies)
Discussion started by: revertback
6 Replies

4. Shell Programming and Scripting

Grep command with multiple pattern

Hi, I want to search multiple patterns in a variable. DB_ERR=`echo "$DB_TRANS" | grep "SP2-" | grep "ORA-"` echo $DB_ERR But I am not getting anything in DB_ERR. I want to print each line on seperate line. Could you please help me out in this. Thanks in advance. (14 Replies)
Discussion started by: Poonamol
14 Replies

5. Programming

Control multiple program instances - open multiple files problem

Hello. This shouldn't be an unusual problem, but I cannot find anything about it at google or at other search machine. So, I've made an application using C++ and QtCreator. I 've made a new mime type for application's project files. My system (ubuntu 10.10), when I right click a file and I... (3 Replies)
Discussion started by: hakermania
3 Replies

6. Shell Programming and Scripting

Grep multiple instances and send email.

Removed (15 Replies)
Discussion started by: saisneha
15 Replies

7. Shell Programming and Scripting

Grep text between multiple pattern

Hello everybody, I have been looking around but can't figure how to do a grep command, that find the text between multiple patterns, example: (pattern1 OR pattern2) AND (pattern3 OR pattern4) text that I want (pattern5 OR pattern6) AND (pattern7 OR pattern8) So how do I find the "text... (4 Replies)
Discussion started by: Benou
4 Replies

8. Linux

Creating 2 variables from a multiple pattern grep

first time poster here Im pretty new to grep and linux in general and I spent pretty much all day yesterday researching and coming up with a grep command to help with my university project. I am attempting to create a proof of concept bash script to scan the network using ngrep, find appropriate... (7 Replies)
Discussion started by: scottish_jason
7 Replies

9. Shell Programming and Scripting

sed and awk usage to grep a pattern 1 and with reference to this grep a pattern 2 and pattern 3

Hi , I have a file where i have modifed certain things compared to original file . The difference of the original file and modified file is as follows. # diff mir_lex.c.modified mir_lex.c.orig 3209c3209 < if(yy_current_buffer -> yy_is_our_buffer == 0) { --- >... (5 Replies)
Discussion started by: breezevinay
5 Replies

10. Shell Programming and Scripting

Grep multiple pattern

I have got a text from each line, I need to fetch port only if there is an ip a.text text and port=25 b.ip=(12.32.54.256) and port="52" c.ip=(55.251.253.12) and port=25" d.text text and port="5" e.ip=(45.211.155.15) and port="457" f.ip=(144.158.256.2) and port="588" I know how to... (6 Replies)
Discussion started by: arpagon
6 Replies
qmail-header(5)                                                 File Formats Manual                                                qmail-header(5)

NAME
qmail-header - format of a mail message OVERVIEW
At the top of every mail message is a highly structured header. Many programs expect the header to carry certain information, as described below. The main function of qmail-inject is to make sure that each outgoing message has an appropriate header. For more detailed information, see http://pobox.com/~djb/proto/immhf.html. MESSAGE STRUCTURE
A message contains a series of header fields, a blank line, and a body: Received: (qmail-queue invoked by uid 666); 30 Jul 1996 11:54:54 -0000 From: djb@silverton.berkeley.edu (D. J. Bernstein) To: fred@silverton.berkeley.edu Date: 30 Jul 1996 11:54:54 -0000 Subject: Go, Bears! I've got money on this one. How about you? ---Dan (this is the third line of the body) Each header field has a name, a colon, some contents, and a newline: Subject: Go, Bears! The field contents may be folded across several lines. Each line past the first must begin with a space or tab: Received: (qmail-queue invoked by uid 666); 30 Jul 1996 11:54:54 -0000 The field name must not contain spaces, tabs, or colons. Also, an empty field name is illegal. qmail-inject does not allow field names with unprintable characters. Case is irrelevant in field names: subject and SUBJECT and SuBjEcT have the same meaning. ADDRESS LISTS
Certain fields, such as To, contain address lists. An address list contains some number of addresses or address groups, separated by commas: a@b, c@d (Somebody), A Person <e@f>, random group: g@h, i@j;, k@l An address group has some text, a colon, a list of addresses, and a semicolon: random group: g@h, i@j; An address can appear in several forms. The most common form is box@host. Every address must include a host name. If qmail-inject sees a lone box name it adds the default host name. All host names should be fully qualified. qmail-inject appends the default domain name to any name without dots: djb@silverton -> djb@silverton.berkeley.edu It appends the plus domain name to any name that ends with a plus sign: eric@mammoth.cs+ -> eric@mammoth.cs.berkeley.edu A host name may be a dotted-decimal address: djb@[128.32.183.163] RFC 822 allows mailbox names inside angle brackets to include source routes, but qmail-inject strips all source routes out of addresses. SENDER ADDRESSES
qmail-inject looks for sender address lists in the following fields: Sender, From, Reply-To, Return-Path, Return-Receipt-To, Errors-To, Resent-Sender, Resent-From, Resent-Reply-To. If there is no From field, qmail-inject adds a new From field with the name of the user invoking qmail-inject. RFC 822 requires that certain sender fields contain only a single address, but qmail-inject does not enforce this restriction. RECIPIENT ADDRESSES
qmail-inject looks for recipient address lists in the following fields: To, Cc, Bcc, Apparently-To, Resent-To, Resent-Cc, Resent-Bcc. Every message must contain at least one To or Cc or Bcc. qmail-inject deletes any Bcc field. If there is no To or Cc field, qmail-inject adds a line Cc: recipient list not shown: ; This complies with RFC 822; it also works around some strange sendmail behavior, in case the message is passed through sendmail on another machine. STAMPS
Every message must contain a Date field, with the date in a strict format defined by RFC 822. If necessary qmail-inject creates a new Date field with the current date (in GMT). Every message should contain a Message-Id field. The field contents are a unique worldwide identifier for this message. If necessary qmail-inject creates a new Message-Id field. Another important field is Received. Every time the message is sent from one system to another, a new Received field is added to the top of the message. qmail-inject does not create any Received fields. RESENT MESSAGES
A message is resent if it contains any of the following fields: Resent-Sender, Resent-From, Resent-Reply-To, Resent-To, Resent-Cc, Resent- Bcc, Resent-Date, Resent-Message-ID. If a message is resent, qmail-inject changes its behavior as follows. It deletes any Resent-Bcc field (as well as any Bcc field); if there are no Resent-To or Resent-Cc fields, qmail-inject adds an appropriate Resent-Cc line. It does not add a Cc line, even if neither To nor Cc is present. If there is no Resent-From field, qmail-inject adds a new Resent-From field. It does not add a new From field. qmail-inject adds Resent-Date if one is not already present; same for Resent-Message-Id. It does not add new Date or Message-Id fields. OTHER FEATURES
Addresses are separated by commas, not spaces. When qmail-inject sees an illegal space, it inserts a comma: djb fred -> djb, fred qmail-inject removes all Return-Path header fields. qmail-inject also removes any Content-Length fields. SEE ALSO
addresses(5), envelopes(5), qmail-inject(8) qmail-header(5)
All times are GMT -4. The time now is 07:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy