Mombu the Programming Forum

Go Back   Mombu the Programming Forum > Programming > looking for pattern in big file
User Name
Password
REGISTER NOW! Mark Forums Read




Reply
1 31st October 18:09
mtfuri
External User
 
Posts: 1
Default looking for pattern in big file



Hi all,
I lost my O'reilly book and wonder if someone can tell me how to use
awk in order to retrieve
oracle colunm names from a big file.

file has text like
select xxxxxx.aaaa, xxxxxx.bbbbbb, yyyyyy.ccccc from ... where (
xxxxxx.aaaaa
and xxxxxxx.bbbbbbb) ........
and there are very many lines like this.
I would like to print out all the colunm names which come after xxxxxx.

I tried to use index command but I got lost while looping toward the
end of the line..
TIA
Uri
  Reply With Quote


 


2 31st October 18:09
janis papanagnou
External User
 
Posts: 1
Default looking for pattern in big file



In what format? Unique names or with duplicates? Start with this...

BEGIN { str="xxxxxx" ; pos=length(str)+2 }
$1 == "select" {
for (f=2; f<=NF; f++)
if ((i=index($f,str))==1)
printf("%s ", substr($f,pos))
print ""
} Janis
  Reply With Quote
3 31st October 18:09
mtfuri
External User
 
Posts: 1
Default looking for pattern in big file


Hi Janis ,
This looks just great thank you for saving my time and nurves !!

Uri
  Reply With Quote
Reply


Thread Tools
Display Modes




666