CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
.CSV | Modify Based On Identifier

 



fork-config
New User

Mar 28, 2016, 3:56 PM

Post #1 of 4 (1627 views)
.CSV | Modify Based On Identifier Can't Post

Hi everyone,

I'm not very familiar with Perl (it's been a while). I'm in a situation where I can spend 5 hours modifying a spreadsheet or develop a simple program.

Sample INPUT CSV Data:
Name Sub Name Items Argument
App1 Ryan red blue green Amounts
App1 Ryan red blue green Quantity
App1 Ryan apples oranges Amounts
App1 Ryan apples oranges Quantity

Sample OUTPUT CSV Data:
Name Sub Name Items Argument
App1 Ryan $red $blue $green Amounts
App1 Ryan red blue green Quantity
App1 Ryan $apples $oranges Amounts
App1 Ryan apples oranges Quantity

For all "Items" with "Argument" = "Amounts", the item should replace each word with a '$' preceding the word.

I have most of the program ready to go. The part I need help with right now is the search and replace part. I am hoping I can do the rest on my own.


FishMonger
Veteran / Moderator

Mar 28, 2016, 4:42 PM

Post #2 of 4 (1624 views)
Re: [fork-config] .CSV | Modify Based On Identifier [In reply to] Can't Post

perldoc perlre - http://perldoc.perl.org/perlre.html


Laurent_R
Veteran / Moderator

Mar 29, 2016, 7:42 AM

Post #3 of 4 (1605 views)
Re: [fork-config] .CSV | Modify Based On Identifier [In reply to] Can't Post

Is it right that some of your records have five fields and others six?

If yes, how are we expected to know which fields to modify?


fork-config
New User

Mar 29, 2016, 7:48 AM

Post #4 of 4 (1601 views)
Re: [Laurent_R] .CSV | Modify Based On Identifier [In reply to] Can't Post

item 1 = red blue green
item 2 = apples oranges

I should have made that more clear, thanks.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives