in reply to How do I search and output results to HTML from a CSV database file?

Well, it's late here, but this will get you started:
#!/usr/bin/perl -w use strict; open (FILE1, "input.txt"); open (FILE2, ">output.txt"); while (<FILE1>) { /^(.+?)\s{1,9}(.+?)\s{1,9}(.+?)$/; print FILE2 "$1,$2,$3\n"; } close FILE2; close FILE1;
Open two files, one for input and the other for output. Read each line in the first, matching the fields. On my example, I match (barely, that regexp is totally half-baked) 3 fields, with 1 up to 9 spaces between them. Store the matched fields in the regexp's history variables ($1/$2/$3), then output that to the file.

Is this what you wanted?
  • Comment on Re: How do I search and output results to HTML from a CSV database file?
  • Download Code