すべてを展開すべてを収束
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
-
|
|
|
|
!
 
more test01.cgi 
#!/usr/bin/perl
 
 
#@list = `netstat -a`;
#print @list;
 
#@list = `/usr/bin/psql -U postgres -l > db-list.txt`;
#print @list;
 
#$retcode = system("chmod 666  db-list.txt");
 
$option = "-F\"\t\" -A -t";
$fname = "sql-result.txt";
$cmd = "/usr/bin/psql $option -U postgres denpyou2 > $fname 2>&1 <<EOSQL\n";
$cmd .= "select * from denpyou\n";
$cmd .= "    where date between '2023-01-01' and '2024-12-31'\n";
$cmd .= "limit 10\n";
$cmd .= "EOSQL\n";
 
#print $cmd;
 
system($cmd);
 
$cmd = "chmod 666 $fname";
system($cmd);
 
open(TEXTFILE, "< $fname") or dir("error : $!");
while(my $line = <TEXTFILE>){
        chomp($line);
        #print "$line\n";
        @fld = split(/\t/, $line);
        print "$fld[1]:$fld[3]\n";
}