Operating System - HP-UX
1752273 Members
4437 Online
108786 Solutions
New Discussion юеВ

Re: unix command sanity check

 
SOLVED
Go to solution
john guardian
Super Advisor

unix command sanity check

could someone please look at the attached text doc and execute the awk command I placed in the attachment and let me know what you get for screen output.

Greatly appreciated. Thanks.
21 REPLIES 21
R.K. #
Honored Contributor
Solution

Re: unix command sanity check

No attachment
Don't fix what ain't broke
john guardian
Super Advisor

Re: unix command sanity check

Sorry. The attachment was there. Let's try this again.

Thx.
R.K. #
Honored Contributor

Re: unix command sanity check

I tried this command on a test server, below is the exact o/p I got:

root# cmd=`which java`
root# echo `/usr/bin/awk '/assemblyIdentity version=/ {print $2} $cmd`

awk: Field $() is not correct.
The input line number is 1.
The source line number is 1.
Don't fix what ain't broke
john guardian
Super Advisor

Re: unix command sanity check

OK. So if that's an incorrect usage, what would be the correct form?
R.K. #
Honored Contributor

Re: unix command sanity check

Hi Again,

Looks like the command is meant to find line containing "assemblyIdentity version=" from the output of "which java".

# which java > /tmp/a1
# awk '/assemblyIdentity version=/ {print $2}' /tmp/a1
# rm /tmp/a1

This should give same results.
Don't fix what ain't broke
Steven Schweda
Honored Contributor

Re: unix command sanity check

> [...] what would be the correct form?

What are you trying to do?
john guardian
Super Advisor

Re: unix command sanity check

I'm attempting to acquire the application major/minor version number w/o having to execute the java -version cmd.
john guardian
Super Advisor

Re: unix command sanity check

Note to RK:

Did you actually try to run the cmd you sent?

I'm getting nothing back from it?

If you did, can you send me the cmd used along with the screen output?
Steven Schweda
Honored Contributor

Re: unix command sanity check

> I'm attempting to acquire the application
> major/minor version number w/o having to
> execute the java -version cmd.

Huh? What is "the application"? Java
itself, or some Java program? If you want
the Java version, what's wrong with "java
-version"?

> What are you trying to do?

Still a mystery. What, exactly, are you
trying to do?