10-09-2008
negate search help
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
outputfile:
pr_name1
pr_name2
pr_name3
pr_name4
pr_name1
pr_name2
pr_name3
pr_name4
The 2 codes that I've found so far are:
sed -ne '/Paragraph1/s/Paragraph1 contents: die1, die2, die3, pr/pr/p' inputfile > outputfile
This only give me pr_name1, pr_name2. I want to modify this code sed -ne '/Paragraph./s/Paragraph.(anything in between)pr/pr/p' inputfile > outputfile
awk '/Paragraph1/{print $NF}' inputfile > outputfile
This only give me pr_name2.
thanks.
Last edited by shamushamu; 10-09-2008 at 06:08 PM..
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
Here is my script so far:
set dirs = ` find . -name "message.jar" 2> /dev/null | cut -d "/" -f 2 ` | uniq
foreach dir ( $dirs )
if (grep $dir/* someText==null) --> how do I write this in script?
print $dir
end
end (4 Replies)
Discussion started by: mmdawg
4 Replies
4. 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
5. Shell Programming and Scripting
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... (1 Reply)
Discussion started by: vanand420
1 Replies
6. Shell Programming and Scripting
Hi guys,
as per subject I am having problem with regular expressions.
Example, if i got a string "javax.servlet.http.HttpServlet.service" that may occurred anywhere within a text file.
How can I used the negate pattern matching of regular expression?
I tried the below pattern but it... (4 Replies)
Discussion started by: DrivesMeCrazy
4 Replies
7. 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
8. Web Development
Hello,
I have a situation where I am trying to use Apache's RedirectMatch directive to redirect all users to a HTTPS URL except a single (Linux) user accessing there own webspace. I have found a piece of regular expression code that negates the username:
^((?!andy).)*$but when I try using it... (0 Replies)
Discussion started by: LostInTheWoods
0 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
LEARN ABOUT FREEBSD
dwarf_new_die
DWARF_NEW_DIE(3) BSD Library Functions Manual DWARF_NEW_DIE(3)
NAME
dwarf_new_die -- allocate a new debugging information entry
LIBRARY
DWARF Access Library (libdwarf, -ldwarf)
SYNOPSIS
#include <libdwarf.h>
Dwarf_P_Die
dwarf_new_die(Dwarf_P_Debug dbg, Dwarf_Tag tag, Dwarf_P_Die parent, Dwarf_P_Die child, Dwarf_P_Die left, Dwarf_P_Die right,
Dwarf_Error *err);
DESCRIPTION
Function dwarf_new_die() allocates a new DWARF debugging information entry and links it to another debugging information entry.
Argument dbg should reference a DWARF producer instance allocated using dwarf_producer_init(3) or dwarf_producer_init_b(3).
Argument tag should specify the tag of the newly created debugging information entry. Valid values for this argument are those for the
DW_TAG_* symbols defined in <libdwarf.h>.
Argument parent specifies the parent link of the debugging information entry.
Argument child specifies the first child link of the debugging information entry.
Argument left specifies the left sibling link of the debugging information entry.
Argument right specifies the right sibling link of the debugging information entry.
Only one of arguments parent, child, left and right is allowed to be non-NULL. Application code can subsequently call the function
dwarf_die_link(3) to change the links for the created debugging information entry.
If argument err is not NULL, it will be used to store error information in case of an error.
RETURN VALUES
On success, function dwarf_new_die() returns the newly created debugging information entry. In case of an error, function dwarf_new_die()
returns DW_DLV_BADADDR and sets the argument err.
ERRORS
Function dwarf_new_die() can fail with:
[DW_DLE_ARGUMENT] Argument dbg was NULL.
[DW_DLE_ARGUMENT] More than one of the arguments parent, child, left and right were non-NULL.
[DW_DLE_MEMORY] An out of memory condition was encountered during the execution of the function.
EXAMPLES
To create debugging information entries and add them to the producer instance, use:
Dwarf_P_Debug dbg;
Dwarf_P_Die die1, die2;
Dwarf_Error de;
/* ... assume dbg refers to a DWARF producer instance ... */
die1 = dwarf_new_die(dbg, DW_TAG_compilation_unit, NULL, NULL, NULL,
NULL, &de);
if (die1 == NULL) {
warnx("dwarf_new_die failed: %s", dwarf_errmsg(-1));
return;
}
die2 = dwarf_new_die(dbg, DW_TAG_base_type, die1, NULL, NULL,
NULL, &de);
if (die1 == NULL) {
warnx("dwarf_new_die failed: %s", dwarf_errmsg(-1));
return;
}
if (dwarf_add_die_to_debug(dbg, die1, &de) != DW_DLV_OK) {
warnx("dwarf_add_die_to_debug failed: %s", dwarf_errmsg(-1));
return;
}
SEE ALSO
dwarf(3), dwarf_add_die_to_debug(3), dwarf_die_link(3), dwarf_producer_init(3), dwarf_producer_init_b(3)
BSD
September 4, 2011 BSD