>Anyone have a stript or advise on how to extract file name, table
>names and field names from 13 stored procedures
>For example
>Procedure1
>Select
>aaa
>,bbb
>,ccc
>,ddd
>,eee
>from
>table1, table2
>Procedure2
>Select
>aaa
>,bbb
>,ccc
>,ddd
>,eee
>from
>table1, table2, table3
>I'd like to create a flatfile formated as followed
>Procedure1|aaa|bbb|ccc|ddd|eee|*|table1|table2
>Procedure2|aaa|bbb|ccc|ddd|eee|*|table1|table2|table3
Untested solution:
awk '/^$/ { }
!inproc && /^Procedure/ { printf("%s|", $0); inproc=1 }
!selecting && /^Select/ { selecting=1 }
selecting && /^from/ { selecting=0 }
{ if (selecting) {
sub("^,", ""); /* remove the leading comma if necessary */
printf("%s|", $0);
} else {
gsub(", *", "|");
printf("*|%s\n", $0)
inproc=0;
}
}
--
Genuity Managed Services, a Level(3) Company, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.