Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sed pattern matching question

Status
Not open for further replies.

gcazian

MIS
Dec 4, 2002
61
US
Hi, I am new to sed and have a quick question.

I am trying to match the output of the 'java -version' command. However, I onlt want to match from the word 'Classic' onto the end of the line:

java version "1.2.2"
Classic VM (J2RE 1.2.2 IBM build ca122-20041020 (JIT enabled: jitc))

How do I do this?

 
So, with your sample input, what is your expected result ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV,

I just want this:

Classic VM (J2RE 1.2.2 IBM build ca122-20041020 (JIT enabled: jitc))

I think the output is one line; I tried to tail -1 the output, but still got the 'java version "1.2.2"' portion as well.
 
something like this ?
java -version | sed -n '/Classic/p'

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
FYI,
Solaris' 'java -version' outputs its version to stderr - you may need to redirect stderr to stdout:

java -version 2>&1 | sed -n '/^Classic/p'

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top