Charles,
Ouch! You dream bigger than I did. :-)
You are correct in that my script doesn't address your example.
I'd say that kind of data is "Unintelligable(word?)" and needs
to be "Re-CSV'd".
Don't get me wrong, I'm not running from it, I just want "Real Data"
before investing that kind of time in a script.
Bryan,
I second Charles, NEED INPUT!
Have fun,
--
Rick L. Mantooth
[EMAIL PROTECTED]
Time is what keeps things from happening all at once
On Tue, 18 Jan 2000, Charles Galpin wrote:
=> Hi Rick
=>
=> *if* this guys data is really CSV, then by definition, the ',' is the
=> field delimiter. In order to allow ',' characters in the filed data, the
=> data can be enclosed in '"' characters. I don't think they are required
=> though in his data it sounds like all fields are enclosed in '"' chars.
=> Anyway, if the fieled is enclosed in '"' chars, you have to escape any '"'
=> characters in the data with another '"' like this '""'.
=>
=> So, I think better test data would be
=>
=> "Junk_1","Junk_2","Junk"_3","Junk_4"
=> "Junk""_5","""Junk_6""",",Junk_7,","Ju,""nk_8"
=>
=> Which this script does not handle properly. I honestly don't know awk well
=> enough to fix it. :)
=>
=> Gate, I think it's time you posted a few lines of sample data.
=>
=> charles
=>
=> On Tue, 18 Jan 2000, Rick L. Mantooth wrote:
=>
=> > Bryan,
=> > Don't listen to those perl guys... ;-)
=> > See below
=> >
=> > On Tue, 18 Jan 2000, Gate wrote:
=> >
=> > => I need to do the following two things (separately):
=> > =>
=> > => First.. I have a file with comma delineated fields. The data in each field
=> > => is enclosed in double quotes ("). However, some data fields have a quote
=> > => within the quotes, and I need to remove that. What is my best choice for
=> > => this?
=> >
=> > Ok,
=> > *Assuming* Some_File looks like this:
=> >
=> > "Junk_1","Junk_2","Junk"_3","Junk_4"
=> > "Junk"_5","Junk_6","Junk_7","Junk_8"
=> >
=> > Syntax without "points off"
=> > quotes.awk < Some_File > Some_New_File
=> >
=> > #!/usr/bin/gawk -f
=> > # quotes.awk
=> > # Input Data was:
=> > # "Junk_1","Junk_2","Junk"_3","Junk_4"
=> > # "Junk"_5","Junk_6","Junk_7","Junk_8"
=> > BEGIN{
=> > FS=","
=> > }
=> > {
=> > for(x=1;x<=NF;x++){
=> > if(! match("\"[a-zA-Z0-9].*\"",$x) >0){
=> > gsub("^\"","",$x)
=> > gsub("\"$","",$x)
=> > gsub("\"","",$x)
=> > }
=> > }
=> > gsub(" ","\",\"",$0)
=> > printf "\"%s\"\n",$0
=> > }
=> > # end quotes.awk
=> >
<munch>
=> --
=> To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
=> as the Subject.
=>
=>
--
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.