This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Linux / UNIX and the fly likes less or > doesn't always work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "less or > doesn Watch "less or > doesn New topic
Author

less or > doesn't always work

sonny kher
Ranch Hand

Joined: Nov 06, 2001
Posts: 83
when I try to pipe output from a build file to less or to a file, it doens't always catch everything. Why so?
ant > tempFile only writes like a couple of lines when the screen stdout sees like 50
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
There are actually two output streams (corresponding to System.out and System.err in Java). The '>' redirection only redirects the basic output stream, not the errors stream..
To redirect the error stream use 2>


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Guy Allard
Ranch Hand

Joined: Nov 24, 2000
Posts: 776
Hi - One (among several) neat trick is:
some_command 2>&1 | tee logfile.txt
G.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: less or > doesn't always work