• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to process the "java -verbose:class" output info in the command.

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello every one.
I can use java -verbose:class command record some loaded class information.
for example
java -verbose:class application > record.txt

all class info will be in the record.txt.

record.txt
class load: java/lang/Long
class load: java/lang/Boolean
class load: java/lang/Byte
class load: java/lang/Character
class load: java/lang/Integer
..

I want to record.txt like the below:
java/lang/Long
java/lang/Boolean
java/lang/Byte
java/lang/Character
java/lang/Integer

just delete the string "class load".

I want to to do this in the command line .
So my satisfied answer will like this:

java -verbose:class application "some process" > record.txt

thanks very much
 
jing hu
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am sorry I find that in my application java -verbose:class info is system.err info.



but in sun jdk , -verbose info is stdout.
using java -verbose: class | sed ... > record.txt can do this.

So I must modify my question.

If -verbose:class is considered as system.info. how to pass this info to pipe?
thanks .
 
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can redirect both stdout and stderr to the same file, e.g.
 
jing hu
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So my quesion can be like this.
A simple java program.


run java HelloWorld > record.txt
record.txt will be like this:
no need tags: value1
no need tags: value2
no need tags: value3
no need tags: value4
no need tags: value5
no need tags: value6

I want to record.txt like the blow
value1
value2
value3
value4
value5
value6


my satisfied answer is like this
java HelloWorld "some process "> record.txt

thanks very much


 
jing hu
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the command &> only can pass the info to file . It can not do any processing. I want to do all processing before the info is written into the file.
 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> is for stdout. If you want stderr, you need 2>, e.g.
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
stdout and stderr are actually numbered 1 and 2 respectively. So the following will redirect stderr to stdout: The &1 is a reference to stdout. Just one thing: redirect stdout first, or stderr will be redirected to the old stdout:
 
jing hu
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Rob

"2&>1" can finish my goal pefectly.
 
jing hu
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Freddy Wong wrote:> is for stdout. If you want stderr, you need 2>, e.g.



Thanks Freddy, your answer is very cool.
reply
    Bookmark Topic Watch Topic
  • New Topic