A plumbers diet

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

A plumbers diet

Jason Martin
BFPD_csv_07132018.zip from : (40.1 MB)

https://urldefense.proofpoint.com/v2/url?u=https-3A__www.ars.usda.gov_ARSUserFiles_80400525_Data_BFPDB_BFPD-5Fcsv-5F07132018.zip&d=DwIDaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=_6rXNpPJ1fYV-3bV1za02NiR4PUelvicfHXwtnTXpXE&m=TsBCQ0FQ0GLWEI9qzpY6iI7qMcEZOTlW4DxN7euidXc&s=-mG5HljtFCuyuV7dSQvGYGmQiRw6nIZWQMT5XveBd4I&e= 

unzip it:

pipe "(groceries sep |) diskr Products.csv  | reverse | chop str /","/ |
drop 1 | reverse | split , | console"

Produces 3.5 million plus items to shop for. [Not pretty or perfect]

Does great job on the speed and memory!!!


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: A plumbers diet

Jason Martin
Correction: chop str missing single quote

pipe "(groceries sep |) diskr Products.csv  | reverse | chop str '\",\"'
| drop 1 | reverse | split , | console"

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: A plumbers diet

jlturriff
On 2019-08-14 17:00:30 Jason Martin wrote:

> Correction: chop str missing single quote
>
> pipe "(groceries sep |) diskr Products.csv  | reverse | chop str '\",\"'
>
> | drop 1 | reverse | split , | console"
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : https://urldefense.proofpoint.com/v2/url?u=http-3A__ibm-2Dnetrexx.215625.n3.nabble.com_&d=DwIFaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=_6rXNpPJ1fYV-3bV1za02NiR4PUelvicfHXwtnTXpXE&m=-ENDYk12yTEWGQmFeYRJlj4AiSv1TLd5wObHFy2dNSM&s=fnQwd6QUARQAszLQ61wwUU4wY5eJYrK9Su0KAT6tCRs&e= 

        Do NRX Pipes stages like chop str accept strings delimited by either ' or "?

Leslie

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: A plumbers diet

Jason Martin
In reply to this post by Jason Martin
 From the docs, all I could gather was the word delimitedString.

I am sure "some string" works but I needed the actual quote characters
for this.

It is a csv file and some of the fields also contain " and , characters.

To separate, I reversed the line and chopped at the first [quote comma
quote] which was the last field.

I am also using ksh on OpenBSD and not bash.


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: A plumbers diet

Jeff Hennick-3

Jason,

This is from the IBM Pipelines manual:

delimitedString
/(diagonal) is any nonblank delimiting character that does not appear in string. You cannot use a B, b, X, x, H, or h for a delimiting character.
So, "...." is a DString, so is '...', or /.../ (and this is used in the documentation), or !...!, or even a...a.  Any character that is not in the actual string.

Jeff

On 8/15/2019 5:06 AM, Jason Martin wrote:
From the docs, all I could gather was the word delimitedString.

I am sure "some string" works but I needed the actual quote characters for this.

It is a csv file and some of the fields also contain " and , characters.

To separate, I reversed the line and chopped at the first [quote comma quote] which was the last field.

I am also using ksh on OpenBSD and not bash.


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: A plumbers diet

Jason Martin
In reply to this post by Jason Martin
That is very helpful Jeff, thanks.

I am guessing you must know how each shell treats passing it.

I do not remember the rules on " for Rexx.

And have not looked at the rules for escaping stuff in each shell.

Should work but does not.

chop str '","'
chop str /","/
chop str a","a

They may work inside nrws but I have not tried.

These three work:
chop str '\",\"'
chop str /\",\"/
chop str a\",\"a

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/