Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Parsing and modifying CSV files

by graff (Chancellor)
on Sep 24, 2005 at 14:13 UTC ( #494771=note: print w/replies, xml ) Need Help??

in reply to Parsing and modifying CSV files

I'm having trouble following your statement of the problem. After showing samples of the file data, you said:
If an item from file1 is in-stock, I need to update the field to the left of the size(SM,MD,LG,XL) to zero in file2.
Okay, this seems to mean that if a line in file1 starts with a non-zero value, some corresponding slot in file2 should be set to zero. But then you add "desired output should be:"
But, the only difference between this "desired output" and the sample data for file2 is that a couple zeros in the original record have been removed, leaving empty fields next to the sizes that were apparently "out of stock" in file1.

You didn't say anything above about wanting to delete field contents for "out of stock sizes", and in this example, your stated goal of setting a field to zero looks like a no-op -- the field to the left of "MD" was already zero in the original file2 data, so there should be nothing to do.

What do you really want?

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://494771]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2023-03-27 07:35 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (63 votes). Check out past polls.