HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: script output columns
Operating System - HP-UX
1837896
Members
3359
Online
110122
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2008 08:44 AM
04-10-2008 08:44 AM
Does anyone know how to make these columns
come out striaght. Here is the output and
the code is below. I'm not much on tclsh.
--------------
Count of problem log files during Email collection
Tester Site Errors
ats182 Irving 0
ats182 Seattle 0
ats182 BESC 0
ats182 EPSC 0
ats195 Seattle 0
ats195 BESC 0
ats195 Irving 0
ats195 ASPC 0
----------------------------
#!/usr/bin/sh
# Comment with backslash required here. \
exec ${TCL_HOME}/bin/tclsh "$0" "$@"
set CB $env(CollectBox);
proc CountSite {Tester SubDir} {
set Count [open "| find $SubDir -type f |
wc"];
gets $Count cnt;
close $Count;
puts "$Tester \t[file tail $SubDir] \t[lindex $cnt 0]" ;
}
puts "\nCount of problem log files during Email collection\n";
puts "Tester\t\tSite \t\tErrors\n";
foreach Tester [glob $CB/*] {
if [file exists $Tester/Oops] {
foreach SubDir [glob -nocomplain $Tester/Oops/TST/*] {
CountSite [file tail $Tester] $SubDir;
}
}
}
come out striaght. Here is the output and
the code is below. I'm not much on tclsh.
--------------
Count of problem log files during Email collection
Tester Site Errors
ats182 Irving 0
ats182 Seattle 0
ats182 BESC 0
ats182 EPSC 0
ats195 Seattle 0
ats195 BESC 0
ats195 Irving 0
ats195 ASPC 0
----------------------------
#!/usr/bin/sh
# Comment with backslash required here. \
exec ${TCL_HOME}/bin/tclsh "$0" "$@"
set CB $env(CollectBox);
proc CountSite {Tester SubDir} {
set Count [open "| find $SubDir -type f |
wc"];
gets $Count cnt;
close $Count;
puts "$Tester \t[file tail $SubDir] \t[lindex $cnt 0]" ;
}
puts "\nCount of problem log files during Email collection\n";
puts "Tester\t\tSite \t\tErrors\n";
foreach Tester [glob $CB/*] {
if [file exists $Tester/Oops] {
foreach SubDir [glob -nocomplain $Tester/Oops/TST/*] {
CountSite [file tail $Tester] $SubDir;
}
}
}
Solved! Go to Solution.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2008 01:49 PM
04-10-2008 01:49 PM
Solution
Hello,
If I understand your question correctly,
you want to format the output from the
script execution.
Then, you do not use command puts alone but add
format to it. Something like:
puts [format "%7s\t%10s\t%s\n" $Tester $[file tail $SubDir] $[lindex $cnt 0]]
The format command returns a string that is
sent to the standard output device with the
puts command.
Cheers,
VK2COT
If I understand your question correctly,
you want to format the output from the
script execution.
Then, you do not use command puts alone but add
format to it. Something like:
puts [format "%7s\t%10s\t%s\n" $Tester $[file tail $SubDir] $[lindex $cnt 0]]
The format command returns a string that is
sent to the standard output device with the
puts command.
Cheers,
VK2COT
VK2COT - Dusan Baljevic
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2008 06:32 AM
04-11-2008 06:32 AM
Re: script output columns
Thanks, that looks better. I could not find
any man tclsh reference to "format". Do you
know where this is documented. Also, I had
to take out the $'s next to [file and
[lindex you had or it would print $'s next
to the output value. I just have to work on
the header columns now.
puts [format "%7s\t%10s\t%s\n" $Tester [file tail $SubDir] [lindex $cnt 0]] ;
Tester Site Oopsies
ats182 Irving 0
ats182 Seattle 0
ats182 BESC 0
ats182 EPSC 0
ats195 Seattle 0
ats195 BESC 0
ats195 Irving 0
any man tclsh reference to "format". Do you
know where this is documented. Also, I had
to take out the $'s next to [file and
[lindex you had or it would print $'s next
to the output value. I just have to work on
the header columns now.
puts [format "%7s\t%10s\t%s\n" $Tester [file tail $SubDir] [lindex $cnt 0]] ;
Tester Site Oopsies
ats182 Irving 0
ats182 Seattle 0
ats182 BESC 0
ats182 EPSC 0
ats195 Seattle 0
ats195 BESC 0
ats195 Irving 0
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP