Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Displaying the Second Line of the Grep Search Results Post 302442127 by siba.s.nayak on Tuesday 3rd of August 2010 10:01:32 AM
Old 08-03-2010
I think it would be helpful.

Code:
bash-3.00$ cat sample.txt
connect
connect
disconnect
that one
connect
disconnect
that one too
connect
disconnect
disconnect
connect
connect
disconnect
that one too
bash-3.00$

Code:
 grep -A 1 "disconnect" sample.txt | grep -v "disconnect"

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

diffrent results between command line and scripted grep

When I type a command at the command line it supplies one result and the exact same command in a script egrep '^01|^02|^03|^04' file > fileout count = 29353 same count in the script yields a count of 23492 is there any reason this could be happening. (1 Reply)
Discussion started by: r1500
1 Replies

2. Shell Programming and Scripting

search whole line using grep

hi, how to search whole line using grep in a file. (1 Reply)
Discussion started by: useless79
1 Replies

3. UNIX for Dummies Questions & Answers

Multiple Line search using grep

Hi All, I am trying to search multiple lines in file using grep /sed.And i cant seem to make it work. The File looks like this 5012001,100,AUTOBATCH,FEE,DAILYFEE,0,0 4241 SERVICE DENIED 5012002,100,AUTOBATCH,FEE,DAILYFEE,0,0 4241 SERVICE DENIED... (6 Replies)
Discussion started by: pistachio
6 Replies

4. Shell Programming and Scripting

Search for Files and clear line after results

Hi, this is a little strange, i have the following code: if then echo -e "psa/admin/sbin present " which shows if a directory is present, but what I would like it to do is show the line and then remove its self and show the rest of the script... no idea what to look... (1 Reply)
Discussion started by: foz
1 Replies

5. UNIX for Dummies Questions & Answers

grep line pattern search

Hello everyone, I have been trying to get a list of all files containing a line of this type: };#followed by anything with any spaces (0 or more or 0 or more tabs) before the } and between each of the characters. I have been trying this : grep '*}*;*#*' *.c but I have not been fully... (1 Reply)
Discussion started by: gio001
1 Replies

6. Shell Programming and Scripting

String: Grep / SED for multy line search

Hi, At first I want to please you to provide the solution with grep/sed if possible. :cool: File looks like: wished result: so I want in a new file BLUE@@RED string from first line like: grep "/folder_start" cs_src > tmp1 string from second line: grep "/main" cs_src... (14 Replies)
Discussion started by: unknown7
14 Replies

7. Shell Programming and Scripting

Can ctag and cscope support recording search results and displaying the history results ?

Hello , When using vim, can ctag and cscope support recording search results and displaying the history results ? Once I jump to one tag, I can use :tnext to jump to next tag, but how can I display the preview search result? (0 Replies)
Discussion started by: 915086731
0 Replies

8. Shell Programming and Scripting

Comparing fields of two files and displaying results

Hello , I am trying to compare two files i.e one master file and the other exclusion file. If the second field of masterfile is oracle8 then I need to compare the 3rd field of master file with the 1st field of all the rows of exclusion file else I need to compare 2nd field from master file with... (2 Replies)
Discussion started by: rahul2662
2 Replies

9. Shell Programming and Scripting

Multiple Results of Grep in one Line/String?

Hello, I have a Textfile sees like this "Word1":aksdfjaksdf "Word2":askdfjalsdkfdlsjfasldfj "This is Word3":asdfkjalskdfj what i need is a string which sees like this Word1;Word2;This is Word3 Conclusion always the text within "" which is before the : i tried it with grep.... (10 Replies)
Discussion started by: SwordMaster
10 Replies

10. What is on Your Mind?

Search Results (Search, New, and Today's Topics) Animation Switch

Hey, I added an animation switch on the search results page; so by default the thread previews are off, but if you want to look at them, just click on the green button and the thread previews will turn on (and back off). See image and attached animation: ... (1 Reply)
Discussion started by: Neo
1 Replies
t_rcvdis(3xti)															    t_rcvdis(3xti)

Name
       t_rcvdis - retrieve information from disconnect

Syntax
       #include <xti.h>

       int t_rcvdis(fd, discon)
       int fd;
       struct t_discon *discon;

Arguments
       fd	 Identifies the local transport endpoint.

       discon	 Points to a t_discon structure containing the following members:
		 struct netbuf udata;
		 int reason;
		 int sequence:

		 The members of the t_discon struct have the following meanings:

		 udata	     Identifies any user data that was sent with the disconnect.

		 reason      Specifies the reason for the disconnect through a protocol-dependent reason code.

		 sequence    Identifies  an  outstanding  connect  indication  with which the connection is associated. The sequence field is only
			     meaningful when is issued by a passive transport user who has executed one or more functions and  is  processing  the
			     resulting	connect indications. If a disconnect indication occurs, sequence can be used to identify which of the out-
			     standing connect indications is associated with the disconnect.

Description
       This function is used to identify the cause of a disconnect and to retrieve any user data sent with the disconnect.

       If a user does not care if there is incoming data and does not need to know the value of reason or sequence, discon may	be  NULL  and  any
       user  data  associated with the disconnect is discarded.  However, if a user has retrieved more than one outstanding connect indication, by
       means of and discon is NULL, the user will be unable to identify with which connect indication the disconnect is associated.

       ------------------------------------------------
       Parameters	      Before Call   After Call
       ------------------------------------------------
       fd		      x 	    /
       discon->udata.maxlen   x 	    /
       discon->udata.len      / 	    x
       discon->udata.buf      x 	    (?)
       discon->reason	      / 	    x
       discon->sequence       / 	    ?
       ------------------------------------------------

Return Values
       Upon successful completion, a value of 0 is returned. On failure, a value of -1 is returned, and is set to indicate the error.

Diagnostics
       On failure, t_errno is set to one of the following:

       [TBADF]		   The specified file descriptor fd  does not refer to a transport endpoint.

       [TOUTSTATE]	   The function was issued in the wrong sequence on the transport endpoint referenced by fd.

       [TNODIS] 	   No disconnect indication currently exists on the specified transport endpoint.

       [TBUFOVFLW]	   The number of bytes allocated for incoming data is not sufficient to store the data. If fd is a passive  endpoint  with
			   ocnt > 1, it remains in state T_INCON; otherwise, the endpoint state is set to T_IDLE. The disconnect indication infor-
			   mation to be returned in discon will be discarded.

       [TNOTSUPPORT]	   This function is not supported by the underlying transport provider.

       [TSYSERR]	   A system error has occurred during execution of this function.

See Also
       t_alloc(3xti), t_connect(3xti), t_listen(3xti), t_open(3xti), t_snddis(3xti)

																    t_rcvdis(3xti)
All times are GMT -4. The time now is 04:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy