- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Scrpiting
Categories
Company
Local Language
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
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
Community
Resources
Forums
Blogs
- 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
03-21-2004 11:32 PM
03-21-2004 11:32 PM
Scrpiting
#script.sh
Command1 >> output
Command2 >> output
# cat output
output of command1
output of command2
But if I want it this way:
output of command1 output of command2
how should I write the script 'script.sh'?
Apperciate immediate help!
Anoop
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2004 11:37 PM
03-21-2004 11:37 PM
Re: Scrpiting
Command2 >> output_2
paste output_1 output_2 >> final_output.
Man paste for details.
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2004 11:39 PM
03-21-2004 11:39 PM
Re: Scrpiting
Assuming that command1 is using "echo" to output it's data then use a "\c" to stop the output of the carriage return e.g
echo "here is the data\c"
And command2 can just do an echo normally.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2004 01:46 AM
03-22-2004 01:46 AM
Re: Scrpiting
If output is doable
echo $(Command1)$(Command2) >> output
Steve Steel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2004 09:55 AM
03-22-2004 09:55 AM
Re: Scrpiting
echo "result of command1 \c">>file
echo "result of command2">>file
The \c in the first echo statement suppresses the carriage return that echo normally appends. The second command gets the carriage return.
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2004 01:45 PM
03-22-2004 01:45 PM
Re: Scrpiting
btw... do you want a space between the lines?
you could join the lines after the fact with and editor or awk. For examples:
echo "1,2 j\nw" | ed x
The usage advantage of an editor is that you don't have to deal with an intermediate file.
With intermediate file and with space:
Command1 >> tmp
tr "[\012]" "[ ]"
Command2 >> output
Without space:
Command1 >> tmp
tr -d "[\012]"
Command2 >> output
Or you could fix the problem after the fact:
fix up output with perl with space:
perl -e '$_ = <>; chop; print $_ ." ".<>'
fix up output with 'ed' without space:
echo "1,2 j\nw" | ed -s output
So many options!
:-)
Hein.
Or you cou
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2004 05:07 AM
03-23-2004 05:07 AM
Re: Scrpiting
Not sure what the intent is.
This method appends output of command1 to the bottom of command2
(
command1
command2 ) > output
If the output is multi line and you want them side by side. Paste works
command1 > output1
command2 > output2
paste output1 output2 > output
If you want the output side by side for comparision sdiff does a nice job of delimiting the changes.
command1 > output1
command2 > output2
sdiff output1 output2 > output
If the commands return one line of output and you want them side by side.
echo "$(command1)\c $(command2)" > output
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2004 06:56 PM
03-28-2004 06:56 PM
Re: Scrpiting
Infact I wanted it side by side to make a list of servers and their sendmail versions, to be created through a script.
Paste has worked well.
Regards,
Anoop
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2004 02:25 AM
03-29-2004 02:25 AM
Re: Scrpiting
HTH
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2005 10:12 PM
06-19-2005 10:12 PM