RSS Forums RSS
Please support our Shell Scripting advertiser: Programming Forums
Views: 1311 | Replies: 1 | Solved
Reply
Join Date: Jul 2007
Posts: 2
Reputation: dyoung02 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
dyoung02 dyoung02 is offline Offline
Newbie Poster

awk help

  #1  
Jul 27th, 2007
Hi All,

I am trying to use awk to strip out the java version after I run the java -version command. Unfortunately nothing I try works. Here is the command I am running along with the output:

# /h/jre/bin/java -version
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Server VM (build 1.5.0_06-b05, mixed mode)

I am interested in just the 1.5.0_06 portion. Does anyone know how I can pipe this output to awk and have it return just that value?

Thx!
DY
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2007
Posts: 2
Reputation: dyoung02 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
dyoung02 dyoung02 is offline Offline
Newbie Poster

Re: awk help

  #2  
Jul 27th, 2007
I figured it out. If anyone is interested here is what I did:

/h/jre/bin/java -version 2> javaver.txt
JAVA=`more javaver.txt | awk '{print $3}'`
JAVA_VERSION=`echo $JAVA | awk '{print $1}'`

DY
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 6:35 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC