- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Can awk print to the standard error ?
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
Discussions
Discussions
Discussions
Forums
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
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
тАО01-14-2003 12:46 AM
тАО01-14-2003 12:46 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-14-2003 12:58 AM
тАО01-14-2003 12:58 AM
Re: Can awk print to the standard error ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-14-2003 12:58 AM
тАО01-14-2003 12:58 AM
Re: Can awk print to the standard error ?
awk '...' file 2>file2 1>&2
The standard error to a file and the redirection of the standard output to the same file.
But... what is the sense?
awk '...' file 1>file2 2>&1
obtains the same output.
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-14-2003 01:01 AM
тАО01-14-2003 01:01 AM
Re: Can awk print to the standard error ?
you can use file descriptor 0 for standard input, 1 for standard output, and 2 for standard error:
# awk {print} 1>&2
Regards ...
Armin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-14-2003 01:05 AM
тАО01-14-2003 01:05 AM
Re: Can awk print to the standard error ?
awk ' { if (n==0) print "ERROR" }'
I want ERROR be printed in standard error, not in standard output.
Leif, your suggestion will print on standard error ANY message... I don't want that. I want the error messages be printed in standard error but I also want normal output be printed in standard output.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-14-2003 01:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-14-2003 01:46 AM
тАО01-14-2003 01:46 AM
Re: Can awk print to the standard error ?
I'm surprised, this is your answer? In your first post you're saying this?
My recomendation is:
awk '...' file >file2
grep 'ERROR' file2 >file_error
The selection of the standard output that you want isn't possible.
By the way, is very curious that the all replies beeing similars the points not...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-14-2003 03:40 AM
тАО01-14-2003 03:40 AM
Re: Can awk print to the standard error ?
This is what I needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-14-2003 04:59 AM
тАО01-14-2003 04:59 AM
Re: Can awk print to the standard error ?
You can now go through your profile and find your previous posts and assign points (166 of 227): http://forums.itrc.hp.com/cm/TopSolutions/1,,BR158676!1!questions,00.html
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-15-2003 10:08 AM
тАО01-15-2003 10:08 AM
Re: Can awk print to the standard error ?
'gawk' (gnu awk -- the 'awk' on Linux) supports the following syntax:
awk '{print "error" >> "/dev/stderr" } '
(note the special file name
"/dev/stderr"
)
as in:
# echo | awk '{print "hello"} ; print "error" > "/dev/stderr" } '
hello
error
# echo | awk '{print "hello"} ; print "error" > "/dev/stderr" } ' >/dev/null
error
bv