You could also try something like:
which would seem to be closer to what you requested if pattern1 or pattern2 could appear anywhere on the line besides the 1st field.
If you want to try this on a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk, /usr/xpg6/bin/awk, nawk.
This User Gave Thanks to Don Cragun For This Post:
Hi friends,
This is my very first post on forum, so kindly excuse if my doubts are found too silly.
I am trying to automate a piece of routine work and this is where I am stuck at the moment-I need to grep a particular ID through a file containing many records(which start with <LRECORD> and end... (6 Replies)
Dear Experts,
I need to extract specific records from one file which has multiline records.
Input file pattern is:
============
aaaaaaaa
bbbbbbbb
asdf 1234
cccccccc
dddddddd
============
aaaaaaaa
bbbbbbbb
qwer 2345
cccccccc
dddddddd (7 Replies)
Hi,
I have a input file with the following entries:
1one
2two
3three
1four
2five
3six
1seven
1eight
1nine
2ten
The output should be
1one
2two
3three
1four
2five
3six (2 Replies)
I'm still beginner and maybe someone can help me.
I have this input:
the great warrior a, b, c
and what i want to know is, with awk, how can i detect the string with 'warrior' string on it and print the a, b, and c seperately, become like this :
Warrior Type
a
b
c
Im still very... (3 Replies)
how to use "awk" to print any record has pattern not equal ? for example my file has 5 records & I need to get all lines which $1=10 or 20 , $2=10 or 20 and $3 greater than "130302" as it shown :
10 20 1303252348212B030
20 10 1303242348212B030
40 34 1303252348212B030
10 20 ... (14 Replies)
Hi,
Do anybody know how to print out only those record that column 1 is "a" , then followed by "b"?
Input file :
a comp92 2404242 2405172
b comp92 2405303 2406323
b comp92 2408786 2410278
a comp92 2410271 2410337
a comp87 1239833 1240418
b comp87... (3 Replies)
Take example of below file.
abc.txt
nas1:/abc/test/test1 /test
nas1:/abc/test/test1/test2 /test/abc
nas1:/abc/test/
Now i have a variable that contains "nas1:/abc/test/test1" value , so i need to search the above file for this variable and print only this line.
... (14 Replies)
Discussion started by: mohit_vardhani
14 Replies
LEARN ABOUT REDHAT
regexp_table
REGEXP_TABLE(5) File Formats Manual REGEXP_TABLE(5)NAME
regexp_table - format of Postfix regular expression tables
SYNOPSIS
regexp:/etc/postfix/filename
DESCRIPTION
The Postfix mail system uses optional tables for address rewriting or mail routing. These tables are usually in dbm or db format. Alterna-
tively, lookup tables can be specified in POSIX regular expression form.
To find out what types of lookup tables your Postfix system supports use the postconf -m command.
The general form of a Postfix regular expression table is:
pattern result
When pattern matches a search string, use the corresponding result.
blank lines and comments
Empty lines and whitespace-only lines are ignored, as are lines whose first non-whitespace character is a `#'.
multi-line text
A logical line starts with non-whitespace text. A line that starts with whitespace continues a logical line.
pattern1!pattern2 result
Matches pattern1 but not pattern2.
Each pattern is a regular expression enclosed by a pair of delimiters. The regular expression syntax is described in re_format(7). The
expression delimiter can be any character, except whitespace or characters that have special meaning (traditionally the forward slash is
used). The regular expression can contain whitespace.
By default, matching is case-insensitive, although following the second slash with an `i' flag will reverse this. Other flags are `x' (dis-
able extended expression syntax), and `m' (enable multi-line mode).
Each pattern is applied to the entire lookup key string. Depending on the application, that string is an entire client hostname, an entire
client IP address, or an entire mail address. Thus, no parent domain or parent network search is done, and user@domain mail addresses are
not broken up into their user and domain constituent parts, nor is user+foo broken up into user and foo.
Patterns are applied in the order as specified in the table, until a pattern is found that matches the search string.
Substitution of substrings from the matched expression into the result string is possible using $1, $2, etc.. The macros in the result
string may need to be written as ${n} or $(n) if they aren't followed by whitespace.
EXAMPLE SMTPD ACCESS MAP
# Disallow sender-specified routing. This is a must if you relay mail
# for other domains.
/[%!@].*[%!@]/ 550 Sender-specified routing rejected
# Postmaster is OK, that way they can talk to us about how to fix
# their problem.
/^postmaster@/ OK
# Protect your outgoing majordomo exploders
/^(.*)-outgoing@(.*)$/!/^owner-/ 550 Use ${1}@${2} instead
EXAMPLE HEADER FILTER MAP
# These were once common in junk mail.
/^Subject: make money fast/ REJECT
/^To: friend@public.com/ REJECT
SEE ALSO pcre_table(5) format of PCRE tables
AUTHOR(S)
The regexp table lookup code was originally written by:
LaMont Jones
lamont@hp.com
That code was based on the PCRE dictionary contributed by:
Andrew McNamara
andrewm@connect.com.au
connect.com.au Pty. Ltd.
Level 3, 213 Miller St
North Sydney, NSW, Australia
Adopted and adapted by:
Wietse Venema
IBM T.J. Watson Research
P.O. Box 704
Yorktown Heights, NY 10598, USA
REGEXP_TABLE(5)