Perhaps you could run the following script in batch:
#!/usr/bin/awk -f
BEGIN \
{
FS = ~
accum = 0
}
{
accum += $3
}
END \
{
printf( "sum of prices = %d\n", accum)
}
> -----Original Message-----
> From: Ramya Ramaswamy [mailto:[EMAIL PROTECTED]
> Sent: Saturday, August 6, 2005 04:13 PM
> To: [email protected]
> Subject: SORT help - to split by delimiters
>
> Hi,
>
> I have a requirement which states like this:
>
> Given records like
>
> 1~ABC~99.99~12345
> 123~AB~9.99~567
> 34~c~1.99~345
>
> where there are 4 fields in each record, each separated by a '~'. The third
> field is the price field, which i need to sum up. I wont know the starting
> position / length of the fields. Is there any way that i can sum up the
> price, using Sort or DYL, without having to write a COBOL program using
> UNSTRING?
>
> Thanks in advance,
> Ramya
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
> Search the archives at http://bama.ua.edu/archives/ibm-main.html
>
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html