[HPADM] RE: awk script questin

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


Thanks a ton it was a syntax mistake in substr

-----Original Message-----
From: John Kingsland [mailto:johnk@dtmr.com]
Sent: Monday, October 07, 2002 3:31 PM
To: 'Lal, Neeraj'
Subject: RE: [HPADM] awk script questin

It looks like your sub strings over lap if you want x2 to be character 15
through 23 the definition should be:
x2=substr($0,15,9)

I assume this is what's wrong because x3 starts at character 26

the syntax for substr is substr(string,start_at_position,up_to_max_length)

Hope this helps,

John Kingsland
DTM Research
johnk@dtmr.com

-----Original Message-----
From: hpux-admin-owner@DutchWorks.nl
[mailto:hpux-admin-owner@DutchWorks.nl]On Behalf Of Lal, Neeraj
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