Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New to CGI - need update AccessTable

Status
Not open for further replies.

Chesterex1

Vendor
Mar 31, 2003
34
0
0
CA
I know Access extremely well - but not Perl or CGI.
I have been given a last minute project where I must make a series of reports based off data given to me from a .cgi page.The web developer gives me a text file (pipe character delimited) - problem is it is 474 fields and Access is limited to 255 fields. Is there a simple perl script that can strip a file at a given field?
I tried opeining the file as a sequential file in VB Script - but the pipes are not recognized as field deliminators.
Any help would be GREATLY appreciated!!
 
Code:
#!usr/bin/perl
open FH, &quot;<whatever_delimited_file&quot;; #means open for input
open FH2, &quot;>first_file&quot;;
open FH3, &quot;>second_file&quot;;
while (<FH>) {
  @fields=split(/\|/, $_);
  for ($loop=0;$loop<254;$loop++) {
    print FH2 &quot;$fields[$loop]&quot;;
    if ($loop<254) {
      print FH2 &quot;<whatever_delimiter_you want>&quot;;
    }
    print FH2 &quot;\n&quot;;
  }
  for ($loop=255;$loop<473;$loop++) {
    print FH3 &quot;$fields[$loop]&quot;;
    if ($loop<473) {
       print FH3 &quot;<whatever_delimeter_you_want>&quot;;
    }
    print FH3 &quot;\n&quot;;
  }
}
close FH;
close FH2;
close FH3;

Sorry don't have your data to test, but you do, and if it's not right it'll give you a head start

HTH
--Paul
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top