[HPADM] RE: awk script questin

From: Lal, Neeraj (Neeraj.Lal@Pfizer.com)
Date: Mon Oct 07 2002 - 15:20:08 EDT


here is the input and ouput example

before

000000100524 BS6646597 SOUTHWEST GENERAL HOSPITAL 7400 BARLITE BLVD
SAN ANTONIO TX 78224 00712
04/01/2002 06/30/2002 111.81
000000100671 BT3937894 TRANSITIONAL HOSPITALS CORP 3601 COLISEUM ST
NEW ORLEANS LA 70115 0000 00712
04/01/2002 06/30/2002 21.32
000000100815 AM3923504 MEMORIAL COMM HOSP PHCY 313 STOUGHTON RD
EDGERTON WI 53534 00712
04/01/2002 06/30/2002 9.38

after

00000100524,BS6646597 SOUTHWEST GE ,SOUTHWEST GENERAL HOSPITAL 7400
BARLITE BLVD ,7400 BARLITE BLVD SAN
ANTONIO TX 78224 ,SAN ANTONIO
TX 78224 00712 04/01/2002 06/30/2002 ,TX
78224 00712 04/01/2002 06/30/2002 111.81
,78224 00712 04/01/2002 06/30/2002
111.81 ,00712 04/01/2002 06/30/2002 111.81
,04/01/2002 06/30/2002 111.81 ,06/30/2002 111.81 ,
111.81 0
000000100671,BT3937894 TRANSITIONAL ,TRANSITIONAL HOSPITALS CORP 3601
COLISEUM ST ,3601 COLISEUM ST NEW
ORLEANS LA 70115 0 ,NEW ORLEANS
LA 70115 0000 00712 04/01/2002 06/30/2002 ,LA
70115 0000 00712 04/01/2002 06/30/2002 21.32
,70115 0000 00712 04/01/2002 06/30/2002
21.32 ,00712 04/01/2002 06/30/2002 21.32
,04/01/2002 06/30/2002 21.32 ,06/30/2002 21.32 ,
21.32 0
000000100815,AM3923504 MEMORIAL COM ,MEMORIAL COMM HOSP PHCY 313
STOUGHTON RD ,313 STOUGHTON RD
EDGERTON WI 53534 ,EDGERTON
WI 53534 00712 04/01/2002 06/30/2002 ,WI
53534 00712 04/01/2002 06/30/2002 9.38
,53534 00712 04/01/2002 06/30/2002
9.38 ,00712 04/01/2002 06/30/2002 9.38
,04/01/2002 06/30/2002 9.38 ,06/30/2002 9.38 ,
9.38 0

-----Original Message-----
From: Lal, Neeraj [mailto:Neeraj.Lal@Pfizer.com]
Sent: Monday, October 07, 2002 3:02 PM
To: 'hpux-admin@DutchWorks.nl'
Subject: [HPADM] awk script questin

Hi Admin

I have written a script using awk to split or cut a file with , delimeted
file

here is my scripts

awk </medicaid/prod/qtrly/final1.tmp > /medicaid/prod/qtrly/final2.txt \
'
{
#Vendor Id
x1=substr($0,1,12);
#Facility ID
x2=substr($0,15,23);
#Facility Name
x3=substr($0,26,55);
#Address
x4=substr($0,58,87);
#City
x5=substr($0,90,104);
#State
x6=substr($0,122,123);
#Zip
x7=substr($0,134,138);
print x1","x2" ,"x3" ,"x4" ,",x5;

but after second feild I am not getting the comma and I am also getting the
3field as duplicate 02 times.

can somebody tell is there anything wrong in the script.

Thanks

Thanks,

Neeraj Lal
Consultant
CHC IS Application & Devlopment
Pfizer Inc.
Neeraj.Lal@Pfizer.com

--
             ---> Please post QUESTIONS and SUMMARIES only!! <---
        To subscribe/unsubscribe to this list, contact
majordomo@dutchworks.nl
       Name: hpux-admin@dutchworks.nl     Owner:
owner-hpux-admin@dutchworks.nl
 
 Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse
only)
            http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse &
search)
--
             ---> Please post QUESTIONS and SUMMARIES only!! <---
        To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
       Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
 
 Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
            http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)


This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 11:02:20 EDT