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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Too many columns in my final awk out script.

Status
Not open for further replies.

tijerina

Vendor
Mar 4, 2003
132
US
I have this one report that has information that I need to extract and formalized into a more readable solution..

Here is the code:


----------Start of Code Snippet--------------------------


BEGIN {
FS=";"
frmt="|%-10.10s|%-8.8s|%-9.9s|%-10.10s|%-6.6s|%-10.10s"
frmt = frmt "|%-8.8s|%-5.5s|%-15.15s|%-4.4s|%-9.9s"
frmt = frmt "|%-9.9s|%-9.9s|%-6.6s|"
frmt = frmt "%-9.9s|%-11.11s|%-9.9s|\n"
printf frmt, "JobNumber", "JobName", "UserName",\
"FileName", "Device", "Device Type", "Priority",\
"Lines", "SrcCreationDate", "Time", "DateClose",\
"TimeClose", "SrcSystem", "System",\
"SpoolFlag", "SpoolFileID", "SrcDevice", "SrcSpoolID"
}
/^#J[0-9]{4}/ {
printf frmt, $1, $2, $3, $4, $5, $6, $7, $8, $9, $10,\
$11, $12, $13, $14, $15, $16, $17, $18
}

----------End of Code Snippet-----------------------------


The results are ugly and it looks too messy.

How would you format when the columns won't fit?? I have more columns that I have to add to the final output report. I do like AWK and we are trying to avoid a dB due to the fact that the HP3000/MPE system will be sunset. This script can be taken with us when we transport to a HP/UX.

This is what I mean about too many colomuns, these are the names of the columns that will be in thr report.

Any help with my issue here will be greatly appreciated..

Thanks...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top