Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Find next line based on pattern, if it is similar pattern skip it Post 302746051 by nagpa531 on Tuesday 18th of December 2012 04:58:48 PM
Old 12-18-2012
Find next line based on pattern, if it is similar pattern skip it

Hi,

I am able to get next line if it is matching a particular pattern. But i need a way to skip if next line also matches same pattern..

For example:

Code:
No Records
No Records
Records found
got it
Records found

Now i want to find 'Records found' after 'No Records' pattern matches..

Code:
sed -n '\No Records/{n;p;}' filename

I am getting 'No Records' but i want to get 'Records found' .Please help me to resolve this.

Last edited by Scrutinizer; 12-19-2012 at 05:11 AM.. Reason: code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

find pattern delete line with pattern and line above and line below

I have a file that will sometimes contain a pattern. The pattern is this: W/D FRM CHK 00 I want to find any lines with this pattern, delete those lines, and also delete the line above and the line below. (1 Reply)
Discussion started by: nickg
1 Replies

2. Shell Programming and Scripting

find pattern, delete line with pattern and line above and line below

I have a file that will sometimes contain a pattern. The pattern is this: FRM CHK 0000 I want to find any lines with this pattern, delete those lines, and also delete the line above and the line below. (4 Replies)
Discussion started by: nickg
4 Replies

3. Shell Programming and Scripting

sed: Find start of pattern and extract text to end of line, including the pattern

This is my first post, please be nice. I have tried to google and read different tutorials. The task at hand is: Input file input.txt (example) abc123defhij-E-1234jslo 456ujs-W-abXjklp From this file the task is to grep the -E- and -W- strings that are unique and write a new file... (5 Replies)
Discussion started by: TestTomas
5 Replies

4. Shell Programming and Scripting

Print a pattern between the xml tags based on a search pattern

Hi all, I am trying to extract the values ( text between the xml tags) based on the Order Number. here is the sample input <?xml version="1.0" encoding="UTF-8"?> <NJCustomer> <Header> <MessageIdentifier>Y504173382</MessageIdentifier> ... (13 Replies)
Discussion started by: oky
13 Replies

5. Shell Programming and Scripting

Grep the word from pattern line and update in subsequent lines till next pattern line reached

Hi, I have got the below requirement. please suggest. I have a file like, Processing Item is: /data/ing/cfg2/abc.txt /data/ing/cfg3/bgc.txt Processing Item is: /data/cmd/for2/ght.txt /data/kernal/config.klgt.txt I want to process the above file to get the output file like, ... (5 Replies)
Discussion started by: rbalaj16
5 Replies

6. Shell Programming and Scripting

To find ls of similar pattern files in a directory by passing the variable.

Hi, I have file in my $datadir as below :- SAT_1.txt SAT_2.txt BAT_UD.lst BAT_DD1.lst DUTT_1.txt DUTT_la.txt Expected result :- should get all the above file in $<Filename>_file.lst Below is my code :- for i in SAT BAT DUTT do touch a.lst cd $datadir (1 Reply)
Discussion started by: satishmallidi
1 Replies

7. Shell Programming and Scripting

Splitting textfile based on pattern and name new file after pattern

Hi there, I am pretty new to those things, so I couldn't figure out how to solve this, and if it is actually that easy. just found that awk could help:(. so i have a textfile with strings and numbers (originally copy pasted from word, therefore some empty cells) in the following structure: SC... (9 Replies)
Discussion started by: luja
9 Replies

8. Shell Programming and Scripting

sed -- Find pattern -- print remainder -- plus lines up to pattern -- Minus pattern

The intended result should be : PDF converters 'empty line' gpdftext and pdftotext?xml version="1.0"?> xml:space="preserve"><note-content version="0.1" xmlns:/tomboy/link" xmlns:size="http://beatniksoftware.com/tomboy/size">PDF converters gpdftext and pdftotext</note-content>... (9 Replies)
Discussion started by: Klasform
9 Replies

9. Shell Programming and Scripting

awk to combine lines from line with pattern match to a line that ends in a pattern

I am trying to combine lines with these conditions: 1. First line starts with text of "libname VALUE db2 datasrc" where VALUE can be any text. 2. If condition1 is met then continue to combine lines through a line that ends with a semicolon. 3. Ignore case when matching patterns and remove any... (5 Replies)
Discussion started by: Wes Kem
5 Replies

10. UNIX for Beginners Questions & Answers

Reading a file line by line and print required lines based on pattern

Hi All, i want to write a shell script read below file line by line and want to exclude the lines which contains empty value for MOUNTPOINT field. i am using centos 7 Operating system. want to read below file. # cat /tmp/d5 NAME="/dev/sda" TYPE="disk" SIZE="60G" OWNER="root"... (4 Replies)
Discussion started by: balu1234
4 Replies
SDPD(8) 						    BSD System Manager's Manual 						   SDPD(8)

NAME
sdpd -- Bluetooth Service Discovery Protocol daemon SYNOPSIS
sdpd [-dh] [-c path] [-G group] [-g group] [-u user] DESCRIPTION
The sdpd daemon keeps a database of Bluetooth Service Records registered on the host and responds to Service Discovery inquiries from remote Bluetooth devices. In order to discover services, remote Bluetooth devices send Service Search and Service Attribute or Service Search Attribute requests over Bluetooth L2CAP connections on the SDP PSM (0x0001). The sdpd daemon will try to find matching Service Records in its Service Database and will return the requested record extracts for the remote device to interpret. The remote device will then make a separate connection in order to access the service. Bluetooth applications, running on the host, are able to insert, remove and update Service Records with the sdpd daemon via the control socket. It is possible to query entire contents of the Service Database locally with sdpquery(1) using the -l option. The command line options are as follows: -c path Specify path to the control socket. The default path is /var/run/sdp. -d Do not detach from the controlling terminal. -G group Grant permission to members of the group to modify the sdpd Service Database. -g group Specifies the group the sdpd should run as after it initializes. The value specified may be either a group name or a numeric group ID. This only works if sdpd was started as root. The default group name is ``_sdpd''. -h Display usage message and exit. -u user Specifies the user the sdpd should run as after it initializes. The value specified may be either a user name or a numeric user ID. This only works if sdpd was started as root. The default user name is ``_sdpd''. FILES
/var/run/sdp SEE ALSO
sdpquery(1), sdp(3) The "Service Discovery Protocol" section of the Bluetooth Core specifications, available at "http://www.bluetooth.com/" HISTORY
The original sdpd daemon first appeared in FreeBSD 5.3 and was imported into NetBSD 4.0 by Iain Hibbert under the sponsorship of Itronix, Inc. This version was rewritten by Iain Hibbert for NetBSD 6.0 in order to allow Bluetooth applications to fully specify service records. AUTHORS
Maksim Yevmenkin <m_evmenkin@yahoo.com> Iain Hibbert CAVEATS
The sdpd daemon will listen for incoming L2CAP connections on a wildcard BD_ADDR. In case of multiple Bluetooth controllers connected to the same host it is possible to limit visibility of Service Records according to the controller the connection is made through. Requests to insert, remove or update service records can only be made via the control socket. The sdpd daemon will check the peer's creden- tials and will only accept the request when the peer is the superuser, of if the peer is a member of the group specified with the -G option. The sdpd daemon does not check for duplicated Service Records and only performs minimal validation of the record data sent in the Insert/Update Record requests. It is assumed that application must obtain all required resources such as RFCOMM channels etc., before regis- tering the service. BUGS
sdpd only ever generates 16-bit sequence headers, so if a response was to grow over UINT16_MAX, the sequence header will be wrong. There is no way for clients to discover the maximum packet size that sdpd will accept on the local socket. Currently this is SDP_LOCAL_MTU as defined in <bluetooth/sdp.h>. BSD
May 7, 2009 BSD
All times are GMT -4. The time now is 05:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy