How to print multiple rows of result set onto a text file ? 
Author Message
 How to print multiple rows of result set onto a text file ?

Hi All,

I am just a beginner and would like to know how to print multiple rows of
results onto a single
text file without using any modules. So far, I am only able to print out a
row of result.

Any quick advice would be appreciated. Thanks All.

Enclosed here is my script :

=====================================================================

#!/usr/bin/perl
#Compare1.pl

# open the source file
open (filehandle1, "dbaora.hhc") or die ("Cannot open dbora.hhc $!\n");

# read through the source file
 while (<filehandle1>)
{
 if ( m/<param name="Name" value="(.*?)">/i )
 {
  #picks up the match from within the parentheses.
  $Value1 = $1;
 $Hash1{$Value1} += 1;
 }

Quote:
}

close (filehandle1);
 open (filehandle2, "dbadb2.hhc") or die ("Cannot open dbadb2.hhc");

# read through the target file
while (<filehandle2>)
{
 if ( m/<param name="Name" value="(.*?)">/i )
 {
  #pick up value from parenthesis
  $Value2 = $1;

  #add to hash for later look-up.
  $Hash2{$Value2} += 1;
 }

Quote:
}

close(filehandle2);

 foreach $Key ( sort keys %Hash1 )
{
  if ( $Hash2{$Key} > 0 )
 {
 next;
 }


Quote:
}

==================================================================
# I would like to store the following result set into the text file and not
only one row.
==================================================================

#show results.
#printf ( "\"Name\" values in dbadb2.hhc missing from dbora.hhc:\n\n" );

open filehandle3, ">Final.txt" or die "Can not open Final.txt";

{
 print  (filehandle3"$Str\n");
 close (filehandle3);

Quote:
}

===================================================================
Sample of the result to be stored into a text file :-
===================================================================

Stop
Synonym Wizard - Panel 1
Synonym Wizard - Panel 2
Synonym Wizard - Panel 3
Synonyms
Table Comments
Table Histograms
Table Wizard  - Last Step
Table Wizard - Panel 4
Table Wizard - Panel 5
Tabl
e Wizard - Panel 6
Table Wizard - Panel 7
TextDocument Object Methods
TextDocument Object Properties
The Call Stack Window
The Dependency Tree Window
The Variables Window
The Watch Window
Toggle Breakpoint
Toolbars
Trigger Wizard - Panel 5
Truncating Clusters
Type Bodies
Types
Unit Detail
Unit Summary
User Wizard - Page 1
User Wizard - Page 2
User Wizard - Page 3
User Wizard - Page 4
Using the De{*filter*}
Using the Profiler
View Comments



Sun, 18 Aug 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. How to print multiple rows of result set onto a text file ?

2. How to print multiple rows of result set onto a text file ?

3. How to print multiple rows of result set onto a text file ?

4. SQL Server, DBI and multiple result sets

5. DBI with INSERT a collection of rows onto database

6. ParseForm onto a Text file Help!

7. adding rows in a text file

8. problem while reading a file row by row

9. need help with a query that has more than 1 row of results

10. Tool: Set operations on (text) DB files (WAS: passwd file mgmt)

11. Printing results of a subroutine to a file

12. Search Text DB file with results...

 

 
Powered by phpBB® Forum Software