- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to group the output of a loop
Operating System - HP-UX
1753506
Members
5278
Online
108794
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
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
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
07-16-2009 06:06 AM
07-16-2009 06:06 AM
Re: How to group the output of a loop
To get the output to 1 "group" I would recommend doing it as a function.
This way you can execute the function within a variable and then you have a grouped output.
Something like this might be the key.
#!/usr/bin/sh
function do_dragon {
e_id=$(sqlplus -s scott/tiger@DB< SET PAGESIZE 0 FEEDBACK OFF VERIFY OFF HEADING OFF ECHO OFF;
select emp_id from employee;
quit
)
group=GROUP1
# Getting the sss_no for each emp_id
for i in $e_id; do
sss_nos=$(sqlplus -s scott/tiger@DB < SET PAGES 0 LINES 500 HEAD OFF;
select sss_no from employee_bank where emp_id = $i;
quit
)
echo "List of SSS no's $sss_nos"
# Run a customize program that calls the sss_nos
# SSS_move
SSS_move $sss_nos $group
sleep 2
done
}
echo "Employee ID's $e_id"
output=$(do_dragon)
echo $output
ps. haven't tested it :P so might need some tweaking ds.
Best regards
Fredrik Eriksson
This way you can execute the function within a variable and then you have a grouped output.
Something like this might be the key.
#!/usr/bin/sh
function do_dragon {
e_id=$(sqlplus -s scott/tiger@DB<
select emp_id from employee;
quit
)
group=GROUP1
# Getting the sss_no for each emp_id
for i in $e_id; do
sss_nos=$(sqlplus -s scott/tiger@DB <
select sss_no from employee_bank where emp_id = $i;
quit
)
echo "List of SSS no's $sss_nos"
# Run a customize program that calls the sss_nos
# SSS_move
SSS_move $sss_nos $group
sleep 2
done
}
echo "Employee ID's $e_id"
output=$(do_dragon)
echo $output
ps. haven't tested it :P so might need some tweaking ds.
Best regards
Fredrik Eriksson
- « Previous
-
- 1
- 2
- Next »
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.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP