|
Prev: Shell audio oscilloscope journey
Next: cheap wholesale:nike shoes,Nike air jordans,wholesale nike acheap wholesale air max,cheap nike shox,jeans,bags,wach,t-shirt in www.wholesaleshoescn.comcheap wholesale air max,cheap nike shox,jeans,bags,wach,t-shirt in www.wholesaleshoescn.comcheap wh
From: webinfinite on 19 Apr 2008 20:39 Hi, I have a document in which I like to look for key words: wordA and wordB. I need to first find where wordA is located in the paragraph and from this position, I need to find wordB's value. For example, Hello, World This { }
From: webinfinite on 19 Apr 2008 20:45 Sorry, I didn't finish in the above thread. Let me reinstate: I have a document in which I like to look for key words: wordA and wordB. I need to first find where wordA is located in the paragraph and from this position, I need to find wordB's value. For example, Hello, World This { value = "ABC" } That { value = "DEF" } I need to first find out "That". At this point, I don't need anything above "That". Then I need to find out in the paragraph under where "That" is located if the value equals "DEF". Could anybody tell me how I can find out two words in paragraph? nawk can be used for keywords in a single line but here I need to do a similar task in a paragraph. Any suggestion?
From: Ed Morton on 19 Apr 2008 21:05 On 4/19/2008 7:45 PM, webinfinite(a)gmail.com wrote: > Sorry, I didn't finish in the above thread. Let me reinstate: > > I have a document in which I like to look for key words: wordA and > wordB. I need to first find where wordA is located in the paragraph > and from this position, I need to find wordB's value. For example, > > Hello, World > This { > value = "ABC" > } > That { > value = "DEF" > } > > I need to first find out "That". At this point, I don't need anything > above "That". Then I need to find out in the paragraph under where > "That" is located if the value equals "DEF". > > Could anybody tell me how I can find out two words in paragraph? nawk > can be used for keywords in a single line but here I need to do a > similar task in a paragraph. Any suggestion? It's easily done in awk. Exactly how depends on more details about your input file, but one way given the file you show above would be: awk -v RS="}" '$1=="That" && $5=="\"DEF\""{ print "found" }' file If that doesn't work on your real input file, provide a more truly representative sample input, expected output from that input, and description of how to find the fields you're interested in. Regards, Ed.
|
Pages: 1 Prev: Shell audio oscilloscope journey Next: cheap wholesale:nike shoes,Nike air jordans,wholesale nike acheap wholesale air max,cheap nike shox,jeans,bags,wach,t-shirt in www.wholesaleshoescn.comcheap wholesale air max,cheap nike shox,jeans,bags,wach,t-shirt in www.wholesaleshoescn.comcheap wh |