Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Lynx Grep Pattern Match 2 conditions Print from Start to End Post 302374399 by kkiran on Tuesday 24th of November 2009 10:58:36 AM
Old 11-24-2009
Lynx Grep Pattern Match 2 conditions Print from Start to End

I am working on a scraping project and I am stuck at this tiny grep pattern match.

Sample text :

Code:
FPA List. FPA List. FPA List. FPA List. FPA List. FPA List. FPA List. FPA List. 
ABC Personal Planning

[67]Catherine K. Wat
[68]Cath Wat
[69]Catherine K. Wat
[70]Catherine K. Wat

IFRAME:
[68]http://www.google.com

In the text above, I want to grab the following data :

Code:
[67]Catherine K. Wat
[68]Cath Wat
[69]Catherine K. Wat
[70]Catherine K. Wat

I did somthing like this :
Code:
kkiran@abc:~$ cat FILE | grep -A 5 'Personal Planning'

But the number of contacts varies , so instead of using -A 5, I want to grab everything before IFRAME starting at 'Personal Planning'. I am sure it is a one line command but I cannot find the right flags for it.

Any help is appreciated..

Last edited by kkiran; 11-24-2009 at 12:13 PM.. Reason: Use code tags, please!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extract a particular start and end pattern from a line

hi In the foll example the whole text in a single line.... i want to extract text from IPTel to RTCPBase.h. want to use this acrooss the whole file Updated: IPTel\platform\core\include\RTCPBase.h \main\MWS2051_Sablime_Int\1... (7 Replies)
Discussion started by: manish205
7 Replies

2. 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

3. Solaris

Using grep to print just the pattern match

Hi all, Is it possible for grep to output just the pattern match and not the whole line when it comes across a match? I know you can adjust the number of trailing or leading lines that are printed, but am yet to find anything that outputs just the pattern match. Cheers, Tim (5 Replies)
Discussion started by: muzzaw
5 Replies

4. Shell Programming and Scripting

Using cat to match pattern start with particular date.

Hi All, version :- SunOS rdrsu1 5.10 Generic_142900-12 sun4u sparc SUNW,SPARC-Enterprise I have a requirenemet, where I have to extrace eroror start with ORA-, which match a perticular date. In below text I only extract out error coming on wed-8 and start with text like "ORA-". hope you... (4 Replies)
Discussion started by: alok.behria
4 Replies

5. Shell Programming and Scripting

Need one liner to search pattern and print everything expect 6 lines from where pattern match made

i need to search for a pattern from a big file and print everything expect the next 6 lines from where the pattern match was made. (8 Replies)
Discussion started by: chidori
8 Replies

6. Shell Programming and Scripting

Pattern match till the end of the file.

I have a file which is like this ……………………………………….. ………………………………… ………………………………… …………………………………… ……………………………………. ……………………………… <<<from_here>>> ……………………………… ………………………………. I want a script which would fetch the data starting from <<<from_here>>> in the file till the end... (2 Replies)
Discussion started by: halfafringe
2 Replies

7. UNIX for Dummies Questions & Answers

Match Pattern after certain pattern and Print words next to Pattern

Hi experts , im new to Unix,AWK ,and im just not able to get this right. I need to match for some patterns if it matches I need to print the next few words to it.. I have only three such conditions to match… But I need to print only those words that comes after satisfying the first condition..... (2 Replies)
Discussion started by: 100bees
2 Replies

8. Shell Programming and Scripting

Match Pattern and print pattern and multiple lines into one line

Hello Experts , require help . See below output: File inputs ------------------------------------------ Server Host = mike id rl images allocated last updated density vimages expiration last read <------- STATUS ------->... (4 Replies)
Discussion started by: tigerhills
4 Replies

9. Shell Programming and Scripting

awk to print fields that match using conditions and a default value for non-matching in two files

Trying to use awk to match the contents of each line in file1 with $5 in file2. Both files are tab-delimited and there may be a space or special character in the name being matched in file2, for example in file1 the name is BRCA1 but in file2 the name is BRCA 1 or in file1 name is BCR but in file2... (6 Replies)
Discussion started by: cmccabe
6 Replies

10. UNIX for Beginners Questions & Answers

Find matched pattern and print all based on certain conditions

Hi, I am trying to extract data based on certain conditions. My sample input file as below:- lnc-2:1 OnePiece tra_law 500 688 1 . . g_id "R792.8417"# tra_law_id "R792.8417.1"# g_line "2.711647"# KM "8.723820"# lnc-2:1 OnePiece room 500 510 1 . . g_id "R792.8417"# tra_law_id "R792.8417.1"#... (7 Replies)
Discussion started by: bunny_merah19
7 Replies
FPA(4)							   BSD Kernel Interfaces Manual 						    FPA(4)

NAME
fpa, fea -- device drivers for DEC FDDI controllers SYNOPSIS
device fpa device fea FreeBSD only: device fddi DESCRIPTION
The fpa and fea device drivers provide support for the DEC DEFPA PCI FDDI Controller and the DEC DEFEA EISA FDDI Controller, respectively. All variants of either controller are supported including the DAS and SAS configurations. DIAGNOSTICS
fea%d: error: desired IRQ of %d does not match device's actual IRQ (%d) The device probe detected that the DEFEA board is configured for a different interrupt than the one specified in the kernel configuration file. fea%d: error: memory not enabled! ECU reconfiguration required The device probe found that no device memory had been configured on the DEFEA. Although the DEFEA can be configured with no device memory, this driver requires a minimum of 1K device memory to be set up. The ECU (EISA Configuration Utility) will need to be run to change the settings. CAVEATS
Normally, the device driver will not enable the reception of SMT frames. However if the IFF_LINK1 flag is set, the device driver will enable the reception of SMT frames and pass them up to the Berkeley Packet Filter for processing. SEE ALSO
arp(4), netintro(4), ifconfig(8) AUTHORS
The fpa and fea device drivers and this manual page were written by Matt Thomas. BSD
March 13, 1995 BSD
All times are GMT -4. The time now is 05:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy