the sql output contains headers for each row returned from a query. sometimes these headers do not appear on the top of the query result-they appear in the middle.
The following is the header print section of the script I wrote:
# PRINT THE FIRST 2 LINE
# OPEN REPORT FOR READING
open (FP,"</usr/home/xxxx/sql.out" || die ("\oops: can't read\sql.out\" -$!\n\n"
# PROCESS EACH LINE IN THE FILE
while ($line=<FP>) {
if ($line =~ /NAME.*ADDRESS.*TEL.*DATE/) {
$header1 = $line;
next;
}
# GRAB ANY LINE THAT BEGINS WITH A '-'
if ($line =~ /^ -/) {
$header2 = $line;
}
}
# CLOSE THE FILE HANDLE
close (FP);
# PRINT OUT RESULTS
print OUTPUT_FILE "$header1\n$header2\n";
The output of this is the following:
NAME ADDRESS TEL DATE
------ ---------- --------------- --------- -----------
question: how can i add EMP# in front of NAME without moving the NAME so that the lines do not become misaligned - is there a way to do this without doing a format?
e.g.
EMP# NAME ADDRESS TEL DATE
------ ---------- --------------- --------- -----------
thanks
The following is the header print section of the script I wrote:
# PRINT THE FIRST 2 LINE
# OPEN REPORT FOR READING
open (FP,"</usr/home/xxxx/sql.out" || die ("\oops: can't read\sql.out\" -$!\n\n"
# PROCESS EACH LINE IN THE FILE
while ($line=<FP>) {
if ($line =~ /NAME.*ADDRESS.*TEL.*DATE/) {
$header1 = $line;
next;
}
# GRAB ANY LINE THAT BEGINS WITH A '-'
if ($line =~ /^ -/) {
$header2 = $line;
}
}
# CLOSE THE FILE HANDLE
close (FP);
# PRINT OUT RESULTS
print OUTPUT_FILE "$header1\n$header2\n";
The output of this is the following:
NAME ADDRESS TEL DATE
------ ---------- --------------- --------- -----------
question: how can i add EMP# in front of NAME without moving the NAME so that the lines do not become misaligned - is there a way to do this without doing a format?
e.g.
EMP# NAME ADDRESS TEL DATE
------ ---------- --------------- --------- -----------
thanks