10-03-2008
Negate gawk search
Hi,
I am using the under-noted script to search the "MYPATTERN" in MYFILE and print that block of lines containing the pattern starting with HEADER upto FOOTER.
Please help me what to put in script to negate the search i.e. not to print those blocks meeting the search criteria.
gawk -v search='MYPATTERN' '
/HEADER/,/FOOTER/ {
block = (block ? block ORS : "") $0;
}
/FOOTER/ {
if (block ~ search)
print block;
block = "";
} ' <MYFILE>
Thnx in advance.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a text file that has links in it.
I can write a match for sed to replace the link with anything.
For example:
http://www.google.com
becomes
XxX
But what I'm after is not to replace the link with something but to remove everything else and just leave the link. I want a... (5 Replies)
Discussion started by: muxman
5 Replies
2. Shell Programming and Scripting
Hi Every one
I have a file in the following manner...
AAAAAA*PERFORM WRITEQ
BBDFDD*PERFOMF WRITEQ
FFFF *PERFOMF WRITEQ
i want to find the lines which donot have * in 7th position..
I have tried this but some problem i think...
grep '......*WRITEQ' INpFIle...
any 6 chars not... (7 Replies)
Discussion started by: pbsrinivas
7 Replies
3. Shell Programming and Scripting
I working fine with following statement -
sed '/search_pattern/ s/pattern1/pattern2/' file_name
requirement changes , now i want negate the search something like -
sed '! /search_pattern/ s/pattern1/pattern2/' file_name (this doesn't work)
anybody can plz tell the correct syntax... (2 Replies)
Discussion started by: ajitkumar2
2 Replies
4. Shell Programming and Scripting
Hi, I've tried a lot of negate codes in this forum, but they do not perform what I intended. Please help.
inputfile:
Paragraph1 contents: die1, die2, die3, pr_name1, pr_name2
pr_name3, pr_name4
Paragraph2 more contents: die1, die2, die3, pr_name1, pr_name2
pr_name3, pr_name4
... (5 Replies)
Discussion started by: shamushamu
5 Replies
5. Shell Programming and Scripting
Hi All...
I have a script that checks for any problems(particularly looks for 'Needs Maintenance') with metadevices and alerts accordingly. This was not configured to alert for a particular metadevice. Now i want to negate alerting for a particular metadevice(say d40). Is this possible? I am... (6 Replies)
Discussion started by: reddybs
6 Replies
6. Shell Programming and Scripting
Im trying to parse ifconfig with awk and setup a bunch of variables in one shot. But Im having trouble figuring out how to work with data in previous lines.
ifconfig output:
eth0 Link encap:Ethernet HWaddr 00:50:DA:10:7F:1B
inet addr:10.10.10.10 Bcast:10.10.10.127 ... (0 Replies)
Discussion started by: trey85stang
0 Replies
7. Shell Programming and Scripting
Hi
I am new to unix and newbie to this forum. I need help in writing a gawk script that search and replace particular text in a flat file.
Input file text :
ZIDE_CONTROL000 100000000003869920900000300000001ISYNC 000002225489 0000000002232122 20120321 16:40:53
ZIDE_RECORD000... (5 Replies)
Discussion started by: gkausmel
5 Replies
8. Shell Programming and Scripting
I am using GAWK to search for a specific pattern:
gawk '{IGNORECASE=1;} /<a href=/&&/\$/,/<\/a/' index.html
<a class=author href="http://washingtondc.craigslist.org/search/?areaID=10&amp;catAbb=sss&amp;query=ps vita" title="craigslist washington, DC | all fo
r sale / wanted search "ps... (1 Reply)
Discussion started by: metallica1973
1 Replies
9. Shell Programming and Scripting
Example:
I have data like,
H|1|2|#||4|4|5|6
D|f|g|h|j|j|k|k|
D|f|g|h|j|j|k|k|
D|f|g|h|j|j|k|k|
D|f|g|h|j|j|k|k|
D|f|g|h|j|j|k|k|
T|g|g|G|G|g|g|
T|g|g|G|G|g|g|
I have to write command, it should delete all the lines except line starting with "D".
I have tried sed '/^\(D\)|/!d'... (2 Replies)
Discussion started by: duplicate
2 Replies
10. Shell Programming and Scripting
Hi All,
New to this forum (and yes , a newbie in programming..:p)
I have a decimal to binary converter script done this way :
i=$1
bit0=$(( (i & 0x01) > 0 ))
bit1=$(( (i & 0x02) > 0 ))
bit2=$(( (i & 0x04) > 0 ))
bit3=$(( (i & 0x08) > 0 ))
bit4=$((... (6 Replies)
Discussion started by: digiteltlc
6 Replies
lsdev(1M) lsdev(1M)
NAME
lsdev - list device drivers in the system
SYNOPSIS
driver | class] block_major] char_major] major] [major ...]
DESCRIPTION
The command lists, one pair per line, the major device numbers and driver names of device drivers configured into the system and available
for invocation via special files. A in either the block or character column means that a major number does not exist for that type.
If no arguments are specified, lists all drivers configured into the system.
If the option is specified, will not print a heading. This option may be useful when the output of will be used by another program.
The and options are used to select specific device drivers for output. If more than one option is specified, all drivers that match the
criteria specified by those options will be listed. These search options are divided into two types: name search keys (the and options)
and major number search keys (the and options). If both types of options are present, only entries that match both types are printed. The
same type of option may appear more than once on the command line with each occurrence providing an ORing effect of that search type. The
and options may not be specified at the same time.
The ability to process major arguments is provided for compatibility and functions like the option.
Options
List device drivers that match
class.
List device drivers with the name
driver.
List device drivers with a block major number of
block_major.
List device drivers with a character major number of
char_major.
List device drivers with either a character
major number or block major equal to major.
DIAGNOSTICS
The and options may not be specified at the same time.
A major number is malformed or out of range.
EXAMPLES
To output entries for all drivers in the class:
To output entries that are in the class that have either a block or character major number of
To get the character major number of into a shell environment variable:
WARNINGS
Some device drivers available from the system may be intended for use by other drivers. Attempting to use them directly from a special
file may produce unexpected results.
A driver may be listed even when the hardware requiring the driver is not present. Attempts to access a driver without the corresponding
hardware will fail.
only lists drivers that are configured into the currently executing kernel. For a complete list of available drivers, please run (see
sam(1M).
DEPENDENCIES
Since relies on the device driver information provided in a routine, may not list drivers installed by other means.
AUTHOR
was developed by HP.
SEE ALSO
sam(1M).
Section 7 entries related to specific device drivers.
lsdev(1M)