Complext test extraction


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Complext test extraction
# 1  
Old 04-07-2004
Complext test extraction

Hi All,

Got a bit of a complex grep/awk statement here.

Trying to write a statement which finds the following text in an unstructured HTML file: eg

original file snip:

<form style="margin-top: 0px; margin-bottom: 0px;" name="ladder">
<select class="formtext" size="1" onchange="jumper(document.ladder.lst.options[document.ladder.lst.selectedIndex].value)" name="lst" style="width: 610px;"><option value="/testing/testSearch.cfm?searchClass=agent&amp;idd=1&amp;more=1&amp;alphabetical=1&amp;letter=Y&amp;whichsearc h=ress#ycco">Page 1: Test String here

</option></select>
</form>
<end snip>

The only text I care about is getting the following (see the end of the 4th line)

"ycco" "Test String here"

Note that the above can be any text, so I can't just grep for them. I know that "ress#" is definitely there though.

Any ideas?
# 2  
Old 04-07-2004
ahhh...got it!

grep ress# test.dat | awk '{ FS="#" } { print $2 }' | sed 's/"/:/g' | awk '{ FS=":"} { print $1 $3}'
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shc : trying to test functionality "test" compiling but can not execute

I am testing shc to see if it would help with my need. Im at a point where Im trying to compile and test the "test.ksh" file that comes in the tar ball : shc-3.8.9> shc -v -r -f test.ksh shc shll=ksh shc =-c shc =exec '%s' "$@" shc = shc opts= shc: cc test.ksh.x.c -o test.ksh.x... (7 Replies)
Discussion started by: popeye
7 Replies

2. Shell Programming and Scripting

Prefixing test case methods with letter 'test'

Hi, I have a Python unit test cases source code file which contains more than a hundred test case methods. In that, some of the test case methods already have prefix 'test' where as some of them do not have. Now, I need to add the string 'test' (case-sensitive) as a prefix to those of the... (5 Replies)
Discussion started by: royalibrahim
5 Replies

3. Shell Programming and Scripting

extraction

I have following input @xxxxxx@ I want to extract what's between @....@ that is : xxxx using SED command (6 Replies)
Discussion started by: xerox
6 Replies

4. Shell Programming and Scripting

How to check weather a string is like test* or test* ot *test* in if condition

How to check weather a string is like test* or test* ot *test* in if condition (5 Replies)
Discussion started by: johnjerome
5 Replies

5. Shell Programming and Scripting

Test on string containing spacewhile test 1 -eq 1 do read a $a if test $a = quitC then break fi d

This is the code: while test 1 -eq 1 do read a $a if test $a = stop then break fi done I read a command on every loop an execute it. I check if the string equals the word stop to end the loop,but it say that I gave too many arguments to test. For example echo hello. Now the... (1 Reply)
Discussion started by: Max89
1 Replies

6. Shell Programming and Scripting

AWK extraction

Hi all, Can anyone please help me in parsing the following file. Suppose the file is called, example.lst, and has the following content in it. (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (Host = 192.168.2.2) ... (3 Replies)
Discussion started by: harris2107
3 Replies
Login or Register to Ask a Question