Grep three consecutive lines if each lines contains certain string
say we have :
should print:
already in one of the threads below command is used for 2 consecutive line. I want similar command for 3 consecutive line:
Also, please explain how the command works. I have very basic knowledge about awk.
Moderator's Comments:
edit by bakunin: please use CODE-tags yourself. I have provided a few from my own wealth of them as a welcome give, but from now on i will tax every occasion where i have to spend some on your texts with infraction points. Use CODE-tags, as required by the forum rules and we will get along well, though.
need help on this. let say i hv 1 file contains as below:
STRING
Description bla bla bla
Description yada yada yada
Data bla bla
Data yada yada
how do i want to display n lines after the string?
thanks in advance! (8 Replies)
Hi,
I have a log file that I need to monitor as it's being written to, and I want to exclude certain strings from the output. At the moment I'm using ...
tail -f LogFileName_`date +%d`.log | egrep -v "First String To Exclude | 2nd string | 3rd string" ...which works OK - but now I need to... (1 Reply)
I have several very large file that are extracts from Oracle tables. These files are formatted in XML type syntax with multiple entries like:
<ROW>
some information
more information
</ROW>
I want to grep for some words, then print all lines between <ROW> AND </ROW>. Can this be done with AWK?... (7 Replies)
This is a variation of an earlier post found here:
unixcom/shell-programming-scripting/159821-merge-two-non-consecutive-lines.html
User Bartus11 was kind enough to solve that example.
Previously, I needed help combining two lines that are non-consecutive in a file. Now I need to do the... (7 Replies)
am using AIX and I have a string "There is no process to read data written to a pipe". I want to get the output 2 lines before and 4 lines after this string. The string is present like more than 100 times in the log and I want to output, the last result in the log with this string
I tried using... (1 Reply)
I have a file lake this
cat ex1.txt
</DISCOUNTS>
<B2B_SPECIFICATION elem="0">
<B2B_SPECIFICATION elem="0">
<DESCR>Netti 2 </DESCR>
<NUMBER>D02021507505</NUMBER>
</B2B_SPECIFICATION>
<B2B_SPECIFICATION elem="1">
<DESCR>Puhepaketti</DESCR>... (2 Replies)
I have a large dataset with following structure;
C 0001 Carbon
D SAR001 methane
D SAR002 ethane
D SAR003 propane
D SAR004 butane
D SAR005 pentane
C 0002 Hydrogen
C 0003 Nitrogen
C 0004 Oxygen
D SAR011 ozone
D SAR012 super oxide
C 0005 Sulphur
D SAR013... (3 Replies)
Hello,
I'm trying to remove the duplicate consecutive lines with specific string "WARNING".
File.txt
abc;
WARNING 2345
WARNING 2345
WARNING 2345
WARNING 2345
WARNING 2345
bcd;
abc;
123
123
123
WARNING 1234
WARNING 2345
WARNING 2345
efgh; (6 Replies)
Discussion started by: Mannu2525
6 Replies
LEARN ABOUT DEBIAN
net::sip::request
Net::SIP::Request(3pm) User Contributed Perl Documentation Net::SIP::Request(3pm)NAME
Net::SIP::Request - handling of SIP request packets
SYNOPSIS
my $req = Net::SIP::Request->new( 'INVITE',... );
my $ack = $req->create_ack();
DESCRIPTION
Subclass of Net::SIP::Packet for handling request packets. Has methods to create responses to requests and to authorize requests.
EXAMPLES
# create INVITE request
my $invite = Net::SIP::Request->new(
'INVITE', 'sip:you@example.com',
{ from => ..., to => ... },
Net::SIP::SDP->new( ... )
);
# somehow send request and retrieve response $resp
...
if ( $resp->code eq '401' or $resp->code eq '407' ) {
# need to authorize request
$invite->authorize( $resp, [ username, password ] );
# somehow send again and retrieve response $resp
...
}
if ( $resp->code ~m{^[2345]dd} ) {
# got final response, send ACK
my $ack = $invite->create_ack( $resp );
# somehow send $ack
...
}
CONSTRUCTOR
Inherited from Net::SIP::Packet. See there.
METHODS
method
Get method of request.
uri Get URI part of request.
set_uri ( STRING )
Set URI of request to STRING
set_cseq ( NUMBER )
Set sequence number if "CSeq" header to NUMBER.
create_ack ( RESPONSE )
Returns Net::SIP::Request object for ACK request for the case when Net::SIP::Response RESPONSE was received in reply for packet $self.
create_cancel
Returns Net::SIP::Request object to cancel request in $self.
create_response ( CODE, [MSG,] [ \%HEADER, BODY ] )
Returns Net::SIP::Response packet for the received request $self with numerical code CODE and text message MSG. Header for the response
will be based on the request, but can be added or overridden using \%HEADER. If MSG is not given (e.g. argument is missing, second
argument is \%HEADER already) a builtin message for the code will be used.
For details to \%HEADER and BODY see new_from_parts in Net::SIP::Packet.
authorize ( RESPONSE, AUTH )
Tries to authorize request $self based on the information in RESPONSE (a 401 or 407 "Authorization required" response) and AUTH. AUTH
is either "[ user,pass ]" if a global authorization info exists for all realms or "{ realm1 => [ user1,pass1 ], realm2 => [ user2,pass2
],... }" if different credentials are provided for different realms or a callback "callback(realm)->[user,pass]". The realms, for
which authorization is needed, are read from RESPONSE.
The request $self is modified in-place. If a modification occurred, e.g. if (parts of) the authorization requests could be resolved it
will return TRUE, else FALSE.
Supports only RFC2617 with md5 and empty qop or qop 'auth', not md5-sess or qop's like 'auth-int'.
perl v5.14.2 2012-06-26 Net::SIP::Request(3pm)