richsark
asked on
add a syntax to a csv file
Hi folks,
I need a way to to read a file that's in csv format ( keeping in mind the header) like so:
The file can be 1,000 of lines long, the above is just a snipit
I would a way to for the file to be read and spit out an output called "compiled-zones-script.pl"
the contents would look like:
Instead of using concatenate in excel, can this be done in perl script or shell script where I can execute the file assuming that the compile_zones directory is there :) or maybe have the script create it.
Thanks in advance
I need a way to to read a file that's in csv format ( keeping in mind the header) like so:
Country View Zone Zone_Sort Type Storage AD-Domain Servers NS MastersForwarders Region
0.117.176.in-addr.arpa arpa.in-addr.176.117.0 master db.0.117.176.in-addr.arpa
0.134.208.in-addr.arpa arpa.in-addr.208.134.0 master db.0.134.208.in-addr.arpa
The file can be 1,000 of lines long, the above is just a snipit
I would a way to for the file to be read and spit out an output called "compiled-zones-script.pl"
the contents would look like:
named-compilezone -i none -k ignore -j -o ../compile_zones/db.0.117.176.in-addr.arpa 0.117.176.in-addr.arpa db.0.117.176.in-addr.arpa
named-compilezone -i none -k ignore -j -o ../compile_zones/db.0.134.208.in-addr.arpa 0.134.208.in-addr.arpa db.0.134.208.in-addr.arpa
Instead of using concatenate in excel, can this be done in perl script or shell script where I can execute the file assuming that the compile_zones directory is there :) or maybe have the script create it.
Thanks in advance
ASKER
hello oklit, so I can take the above and make a file named compile_zone.sh
or what you provided is a copy paste in a term window in my mac
or what you provided is a copy paste in a term window in my mac
ASKER
also, I ended up with commas ,,, after I ran it.. see below
can we get those out please.
named-compilezone -i none -k ignore -j -o ../compile_zones/ ,,0.218.195.in-addr.arpa,arpa.in-addr.195.218.0,master,db.0.218.195.in-addr.arpa,,,,,
can we get those out please.
Please post your exact csv file (part of it of course). The one you posted in your question didn't have any commas.
ASKER
HI, attached... The file could be tab sep or ,, ( comma ) so we need to account for it please.
Workbook5.csv
Workbook5.csv
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Nice. Thank you !
would I need to post a separate ? to make this a perl script or a shell script?
Thanks again!
would I need to post a separate ? to make this a perl script or a shell script?
Thanks again!
Unfortunately I can't help you with perl.
You can leave these question opened and wait for perl solution, or you can open new one (in that case don't add 'shell scripting' category and write in your question that you are interested in perl solution only).
You can leave these question opened and wait for perl solution, or you can open new one (in that case don't add 'shell scripting' category and write in your question that you are interested in perl solution only).
Open in new window