Sponsored Content
Top Forums Shell Programming and Scripting Search from a line to end of list using sed Post 302840361 by MadeInGermany on Monday 5th of August 2013 10:53:48 AM
Old 08-05-2013
This one allows 1 blank line after the header line
Code:
awk '!(c && c--) && /^ *$/ {p=0} p; /Sporting interest/ {p=1; c=1}'

It is a sequence of implicit if clauses followed by an { action }.
The p; is an implicit if clause without { action } so the default action is { print }
With explicit if clauses and actions it would give
Code:
awk '{if ((c && c--)==0 && /^ *$/) {p=0}} {if (p!=0) {print}} {if (/Sporting interest/) {p=1; c=1}}'

The variable p indicates if something should be printed.
The variable c holds the number of lines to be not considered for searching for end of section. The (c && c--) let it decrement until 0 but not below 0.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

sed to end of line

I know this is going to be an easy anwer, but I haven't been able to figure this out - even with the help of the previous posts. I want to go from this PROD USER anon; to this TEST; I have coded a few sed commands, and none of them are getting the job done. anon will not always be the... (2 Replies)
Discussion started by: djschmitt
2 Replies

2. Shell Programming and Scripting

Number a list at end of line using 'sed'

Hi All I have a script which has produced a list, I have used 'sed' to number my list, but i want to list at end of line with the first line starting at zero (0) and brackets round it ie My List i want Hello (0) this (1) day (2) can (3) be (4) sed '/./=' filename | sed '/./N; s/\n/) /'... (5 Replies)
Discussion started by: chassis
5 Replies

3. Shell Programming and Scripting

Removing character from list line (at the end)

Hi, I have file as shown below. abc, def, abc, xyz, I have to remove ',' from end of last line (xyz,). How can I do that with single command? Is it possible or I have to iterate through complete file to remove that? - Malay (2 Replies)
Discussion started by: malaymaru
2 Replies

4. Shell Programming and Scripting

delete to end of line with SED

I have a file with a bunch of similar lines in which I want to extract a phrase delimited by the first occurance of a '>' at the beginning and the first occurance of a '<' at the end (you might have guessed these are beginning/end of HTML tags). Using Sed I have managed to delete up to and... (7 Replies)
Discussion started by: coldcanuck
7 Replies

5. Shell Programming and Scripting

search directory-find files-append at end of line

Hi, I have a command "get_data" with some parameters in few *.text files of a directory. I want to first find those files that contain this command and then append the following parameter to the end of the command. example of an entry in the file :- get_data -x -m50 /etc/web/getid this... (1 Reply)
Discussion started by: PrasannaKS
1 Replies

6. Shell Programming and Scripting

sed issue with end of line

Example, Trying to replace text to the end of a line. Text file looks like this PP= 4 PP= 412 PP= 425 I want to replace only the following line: PP= 4 with PP= 2 How can this be done with sed? (3 Replies)
Discussion started by: hanson397
3 Replies

7. UNIX for Dummies Questions & Answers

Removing end of line using SED

Hello Friends, How can I remove the last two values of this line using sed John Carey:507-699-5368:29 Albert way, Edmonton, AL 25638:9/3/90:45900 The result should look like this: John Carey:507-699-5368:29 Albert way, Edmonton, AL 25638 (3 Replies)
Discussion started by: humkhn
3 Replies

8. Shell Programming and Scripting

sed removing until end of line

All: Can somebody help me out with a sed command, which removes the the first occurance of ')' until the end of the line If I have the following input ... (5 Replies)
Discussion started by: BeefStu
5 Replies

9. Shell Programming and Scripting

Search for a string, then append character to end of that line only

I have 2 files that I am working with $ cat file1 server1 server3 server5 server6 server8 $ cat file2 server1;Solaris; server2; SLES; server3;Linux; server4; Solaris; server5;SLES; server6;SLES; server7;Solaris; server8;Linux; (1 Reply)
Discussion started by: snoman1
1 Replies

10. Shell Programming and Scripting

sed - go to file and search a part and set at the end text

Hello, i hope the titel is okay. I want to edit a line in /etc/arno-iptables-firewall/firewall.conf So the Line can contains: OPEN_TCP="436, 25, 80, 110, 143, 443, 465, 587, 993, 995, 21, 20" i want to search in this line: OPEN_TCP="*, *, 80, *, *, 443, *, *, *, *" and i want to... (11 Replies)
Discussion started by: tJAdASwIRDESSEI
11 Replies
Bio::SearchIO::EventHandlerI(3pm)			User Contributed Perl Documentation			 Bio::SearchIO::EventHandlerI(3pm)

NAME
Bio::SearchIO::EventHandlerI - An abstract Event Handler for Search Result parsing SYNOPSIS
# do not use this object directly it is an interface # See Bio::SearchIO::SearchResultEventBuilder for an implementation use Bio::SearchIO::SearchResultEventBuilder; my $handler = Bio::SearchIO::SearchResultEventBuilder->new(); DESCRIPTION
This interface describes the basic methods needed to handle Events thrown from parsing a Search Result such as FASTA, BLAST, or HMMer. FEEDBACK
Mailing Lists User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated. bioperl-l@bioperl.org - General discussion http://bioperl.org/wiki/Mailing_lists - About the mailing lists Support Please direct usage questions or support issues to the mailing list: bioperl-l@bioperl.org rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible. Reporting Bugs Report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution. Bug reports can be submitted via the web: https://redmine.open-bio.org/projects/bioperl/ AUTHOR - Jason Stajich Email jason-at-bioperl.org APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ start_result Title : start_result Usage : $handler->start_result($data) Function: Begins a result event cycle Returns : none Args : Type of Result end_result Title : end_result Usage : $handler->end_result($data) Function: Ends a result event cycle Returns : Bio::Search::Result::ResultI object Args : none start_hsp Title : start_hsp Usage : $handler->start_hsp($data) Function: Start a HSP event cycle Returns : none Args : type of element associated hashref end_hsp Title : end_hsp Usage : $handler->end_hsp() Function: Ends a HSP event cycle Returns : Bio::Search::HSP::HSPI object Args : type of event and associated hashref start_hit Title : start_hit Usage : $handler->start_hit() Function: Starts a Hit event cycle Returns : none Args : type of event and associated hashref end_hit Title : end_hit Usage : $handler->end_hit() Function: Ends a Hit event cycle Returns : Bio::Search::Hit::HitI object Args : type of event and associated hashref start_iteration Title : start_iteration Usage : $handler->start_iteration() Function: Starts an Iteration event cycle Returns : none Args : type of event and associated hashref end_iteration Title : end_iteration Usage : $handler->end_iteration() Function: Ends an Iterationevent cycle Returns : Bio::Search::Iteration::IterationI object Args : type of event and associated hashref register_factory Title : register_factory Usage : $handler->register_factory('TYPE',$factory); Function: Register a specific factory for a object type class Returns : none Args : string representing the class and Bio::Factory::ObjectFactoryI See Bio::Factory::ObjectFactoryI for more information factory Title : factory Usage : my $f = $handler->factory('TYPE'); Function: Retrieves the associated factory for requested 'TYPE' Returns : a Bio::Factory::ObjectFactoryI Throws : Bio::Root::BadParameter if none registered for the supplied type Args : name of factory class to retrieve See Bio::Factory::ObjectFactoryI for more information Bio::Event::EventHandlerI methods will_handle Title : will_handle Usage : if( $handler->will_handle($event_type) ) { ... } Function: Tests if this event builder knows how to process a specific event Returns : boolean Args : event type name SAX methods See Bio::Event::EventHandlerI for the additional SAX methods. perl v5.14.2 2012-03-02 Bio::SearchIO::EventHandlerI(3pm)
All times are GMT -4. The time now is 01:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy