[ale] Need AWK Guru input
Lightner, Jeff
JLightner at water.com
Mon Aug 1 13:35:55 EDT 2011
Cool - never ran across that lsb_release command before.
However it gives Version.Subversion (e.g. 5.5, 5.3, 5.1) as well as the keyword "Release:" so if the user just wants the major version (5) he'd still need to strip the trailing number (if there - 5.0 just shows up as 5) and the keyword. Still might be simpler to pipe that to awk since it gives less information though.
One downside to either approach is it might not be correct - sometimes admins muck with /etc/redhat-release because applications check it to install and fail. (Oracle apps are great for that - they tell you RHEL5 is supported but their installation checks fail if they don't find it is RHEL4 for some things.)
Often such hacks are only done on /etc/redhat-release and /etc/issue is left unmolested. My read of lsb_release man page says it parses from /etc/redhat-release so using /etc/issue might be a better way to go.
-----Original Message-----
From: ale-bounces at ale.org [mailto:ale-bounces at ale.org] On Behalf Of The Don Lachlan
Sent: Monday, August 01, 2011 11:29 AM
To: ale at ale.org
Subject: Re: [ale] Need AWK Guru input
On Mon, Aug 01, 2011 at 11:17:33AM -0400, Dennis Ruzeski wrote:
> Something like this?
> cat /etc/redhat-release |awk '/release/ { for (x=1;x<=NF;x++) if
> ($x~"release") print $(x+1) }'
Wouldn't 'lsb_release -r' hand back the same info?
-L
> On Mon, Aug 1, 2011 at 10:52 AM, Chuck Payne <terrorpup at gmail.com> wrote:
> > Guys,
> >
> > I am working on adding servers to my Satellite server, and I like to
> > be able to get in with a script and call on the following
> >
> > /etc/redhat_release
> >
> > But I only want to get the number, so that I can see if it RHEL 4 or
> > 5, I been trying to do with awk, but I am not able to get anything,
> > what is the best way to only put numbers?
> >
> > --
> > (678) 636-9678
> > -----------------------------------------
> > Discover it! Enjoy it! Share it! openSUSE Linux.
> > -----------------------------------------
> > openSUSE -- en.opensuse.org/User:Terrorpup
> > openSUSE Ambassador/openSUSE Member
> > skype,twiiter,identica,friendfeed -- terrorpup
> > freenode(irc) --terrorpup/lupinstein
> > Register Linux Userid: 155363
> >
> > Have you tried SUSE Studio? Need to create a Live CD, an app you want
> > to package and distribute , or create your own linux distro. Give SUSE
> > Studio a try. www.susestudio.com.
> >
> > _______________________________________________
> > Ale mailing list
> > Ale at ale.org
> > http://mail.ale.org/mailman/listinfo/ale
> > See JOBS, ANNOUNCE and SCHOOLS lists at
> > http://mail.ale.org/mailman/listinfo
> >
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
_______________________________________________
Ale mailing list
Ale at ale.org
http://mail.ale.org/mailman/listinfo/ale
See JOBS, ANNOUNCE and SCHOOLS lists at
http://mail.ale.org/mailman/listinfo
Proud partner. Susan G. Komen for the Cure.
Please consider our environment before printing this e-mail or attachments.
----------------------------------
CONFIDENTIALITY NOTICE: This e-mail may contain privileged or confidential information and is for the sole use of the intended recipient(s). If you are not the intended recipient, any disclosure, copying, distribution, or use of the contents of this information is prohibited and may be unlawful. If you have received this electronic transmission in error, please reply immediately to the sender that you have received the message in error, and delete it. Thank you.
----------------------------------
More information about the Ale
mailing list