Advertisement

07.22.2008 at 09:45AM PDT, ID: 23585709
[x]
Attachment Details

Parse text files

Asked by cutie_smily in HP-UX Unix, Unix Systems Programming, Shell Scripting

I have my source text files like below and my requirement is to parse /extract the sql out of this text file and create a new file with same source name (different extension).

I tried to write a simple script using "while read" but couldn't achieve. Any help will be greatly appreciated.

ThanksStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
BEGIN DSRECORD
      Identifier "V0S0P1"
      DateModified "1899-12-30"
      TimeModified "00.00.01"
      OLEType "CCustomOutput"
      Readonly "0"
      Name "lnMember"
      Partner "V0S1"
      Properties "CCustomProperty"
      BEGIN DSSUBRECORD
         Name "SOURCETABLES"
         Value "#TDData#.#Table#"
      END DSSUBRECORD
      BEGIN DSSUBRECORD
         Name "PREFETCH"
         Value "50"
      END DSSUBRECORD
      BEGIN DSSUBRECORD
         Name "WHERE_CLAUSE"
         Value "MEMBER >= '#StartDt#' "
      END DSSUBRECORD
      BEGIN DSSUBRECORD
         Name "OTHER_CLAUSES"
      END DSSUBRECORD
      BEGIN DSSUBRECORD
         Name "USERSQL"
         Value =+=+=+=
SELECT
  M.col1,
  M.col2,
  M.col3
 
FROM #TData#.#Member#  M
 
INNER JOIN #TData#.#TableCntct# G
  ON G.GRP_NBR = M.GRpNO
  AND G.DIVNBR = M.DIVNO
 
ORDER BY 1,2
=+=+=+=
      END DSSUBRECORD
      BEGIN DSSUBRECORD
         Name "BEFORESQL"
      END DSSUBRECORD
      BEGIN DSSUBRECORD
         Name "CONTBEFORESQL"
         Value "YES"
      END DSSUBRECORD
 
Loading Advertisement...
 
[+][-]07.22.2008 at 01:09PM PDT, ID: 22063128

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: HP-UX Unix, Unix Systems Programming, Shell Scripting
Sign Up Now!
Solution Provided By: ozo
Participating Experts: 1
Solution Grade: A
 
 
[+][-]07.22.2008 at 04:13PM PDT, ID: 22064545

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 04:38PM PDT, ID: 22064691

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.24.2008 at 08:42AM PDT, ID: 22080394

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628