This will print only lines containing pattern1 and pattern2
Tanks neutronscott.
Got this far too, but pattern1 is in a different line than pattern2 and i would like to print $1 of line $0 found with pattern1 and $2 of line $0 found with pattern2
Hi,
I have to write one script that has to search a list of numbers in certain zipped files.
For eg. one file file1.txt contains the numbers. File1.txt contains 5,00,000 numbers and I have to search each number in zipped files(The number of zipped files are around 1000 each file is 5 MB)
I have... (10 Replies)
Hi
I am trying to search and replace a multi line pattern in a php file using awk.
The pattern starts with
<div id="navbar">
and ends with
</div>
and spans over an unknown number of lines.
I need the command to be a one liner.
I use the "record separator" like this :
awk -v... (8 Replies)
Thanks for giving your time and effort to answer questions and helping newbies like me understand awk.
I have a huge file, millions of lines, so perl takes quite a bit of time, I'd like to convert these perl one liners to awk.
Basically I'd like all lines with ISA sandwiched between... (9 Replies)
Hi all,
I have a file having data:
@HWUSI-EAS1727:19:6:1:3674:984:0:1#GTTAATA
NTTGGGTTTTCT
@HWUSI-EAS1727:19:6:1:3674:984:0:1#GTTA...
NTTGGGTTTTCT
@HWUSI-EAS1727:19:6:1:3674:984:0:1#.....CT
NTTGGGTTTTCT
I want to print everything starting from # till line ends.
can you please help me how... (5 Replies)
Hi all.
I have the following command that is successfully searching for any one of the strings on all lines of a file and replacing it with the instructed value.
cat inputFile | awk '{gsub(/aaa|bbb|ccc|ddd/,"1234")}1' > outputFile
This does in fact replace any occurrence of aaa, bbb,... (2 Replies)
Given:
1,2,whatever,a,940,sot
how can i print from one particular field to the end of line?
awk -F"," '{print $2 - endofline}'
the delimiter just happens to be a comma "," in this case. in other cases, it could be hypens:
1---2---whatever---a---940---sot (4 Replies)
Coins.txt:
gold 1 1986 USA American Eagle
gold 1 1908 Austria-Hungary Franz Josef 100 Korona
silver 10 1981 USA ingot
gold 1 1984 Switzerland ingot
gold 1 1979 RSA Krugerrand
gold 0.5 1981 RSA Krugerrand
gold 0.1 1986 PRC Panda
silver 1 1986 USA Liberty dollar
gold 0.25 1986 USA Liberty... (2 Replies)
Hi,
OS = Solaris
Can anyone advise if there is a one liner to print specific output from a df -k output?
Running df from a command line, it sometimes gives me 2 lines for some volume. By re-directing the output to a file, it always gives 1 line for each.
Below is an example output,... (4 Replies)
Hello Gurus,
I have a file this
Dir Path 1
Connection pool="somename"; "DataSource Name"="DS name"; Password="pwd"; User Id="uid";some other fields
Dir Path2
Password="pwd2"; User id="uid2"; Connection pool="somename2"; "datasource name"="DS name2";some other fields.
Under each dir... (14 Replies)
Discussion started by: sirababu
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)