Bruce & Breeanna Rennie wrote:
> My purpose is to split a two line CSV file into an appropriate CSV file
> containing may lines. The original files can have anything ranging from
> 30 odd values to near to 1000 values on each line.
Is there something about the values that makes this hard (embedded
separators, etc.)? Unless there is, it should take less time to
write one than to find one. Here's a simple version:
---------------------------------------
procedure main(args)
every line := parseCSV(!&input) do {
# Code to process array of values on each line
}
end
# Produce a list of CSV values from a string.
procedure parseCSV(s, sep)
/sep := ","
A := []
s ? {
while put(A, tab(upto(sep))) do move(1)
put(A, tab(0)) # No separator after last field
}
return A
end
---------------------------------------
It generally doesn't take much longer to handle more
complex cases (e.g. fields can be separated by spans
of separators, fields can contain embedded separators,
etc.), but those cases do require knowing more details
of the format of the CSV file (how are embedded
separators escaped, for example).
--
Steve Wampler -- [EMAIL PROTECTED]
The gods that smiled on your birth are now laughing out loud.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Unicon-group mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/unicon-group