- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to redirect output from a command ??!!!!!!!!!!...
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-16-2004 02:12 AM
03-16-2004 02:12 AM
How to redirect output from a command ??!!!!!!!!!!!
I have a certain application command, which when run, collects huge amount of data from a database. I redirect the gained data(in text format) to an ordinary file. but the trick is when this command runs, it prints in the shell some messages ( such as % of progress, number of collected database entries, and so on ), the question is HOW TO REDIRECT THESE MESSAGES to another file other than the file contains data itself ??
Thanx for your interest
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2004 02:14 AM
03-16-2004 02:14 AM
Re: How to redirect output from a command ??!!!!!!!!!!!
redirects command output to append /tmp/newfile
command 2>&1 | mailx -s "Subject" someone@aol.com
redirects output to background and then email
The tee command splits output between two files.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2004 02:23 AM
03-16-2004 02:23 AM
Re: How to redirect output from a command ??!!!!!!!!!!!
thank you first for your fast responce.
really it is :
command > /usr/file1
file1 now contains database entries.
while it is being run, interactive messages are printed in shell.
HOW TO GET THESE MESSAGES in a SEPARATE file ????
if used tee, i will get the database entries again , not messages !!!!!
Tamer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2004 02:33 AM
03-16-2004 02:33 AM
Re: How to redirect output from a command ??!!!!!!!!!!!
command 2>/dev/null >/yourfile
If that is not the case you will need to filter out those lines through sed,awk, or perl. example-
command | sed '/^%/d' >/yourfile
HTH
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2004 02:34 AM
03-16-2004 02:34 AM
Re: How to redirect output from a command ??!!!!!!!!!!!
If the rogram prints on standard output and the messages as well then forget it
They will go to the same place
If the messages are on standard error
command > /usr/file1 2>otherfile
Only other thing I can think of if both on standard output
command|while read line
do
echo $line|grep -v "%" >> /usr/file1
echo $line |grep "%" >> /usr/file2
done
You will need to extend the greps for all the fields you wnat to move
Steve Steel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2004 02:43 AM
03-16-2004 02:43 AM
Re: How to redirect output from a command ??!!!!!!!!!!!
what database are we talking about?
If it is an oracle script, you can influence, what oracle prints.
Is it a compiled command or do you happen to
have the script for it?
Otherwise, as stated, it is getting nasty.
Perhaps the easiest way would be to filter the data rows with grep, if they have a common structure.
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2004 04:24 AM
03-16-2004 04:24 AM
Re: How to redirect output from a command ??!!!!!!!!!!!
I'm quite sure, that the status messages are written to stderr. So lets collect the remarks you got till now and try
command 2>&1 >/usr/file1 | tee /tmp/errorlog
to see that status messages AND put it to a file.
For the simple redirct use:
command >/usr/file1 2>/tmp/errorlog
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2004 07:32 PM
03-16-2004 07:32 PM
Re: How to redirect output from a command ??!!!!!!!!!!!
I dicovered it is stdrerr and easily separated by " 2> " .I really gained more experience from all your replies.
Again, Thanks a million for all of you !!
Tamer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2004 09:11 PM
03-16-2004 09:11 PM
Re: How to redirect output from a command ??!!!!!!!!!!!
that's what this place is for. ;-)
greetings,
Michael
ps. have you already read this?
http://forums1.itrc.hp.com/service/forums/helptips.do?#28
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2004 09:16 PM
03-16-2004 09:16 PM
Re: How to redirect output from a command ??!!!!!!!!!!!
To redirect the output to a file
#command > filename
To append the output to a file
#command >> filename
Regards,