Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 400
  • Last Modified:

Bash string manipulation

On RHEL, version 5.4 and above,
I would like to extract and match the OCFS2 version with the Linux version:

#uname -r
  retruns:  2.6.18-371.3.1.el5PAE

# rpm -qa | grep ocfs
returns two rows:
  ocfs2-2.6.18-238.el5PAE-1.4.7-1.el5
  ocfs2-tools-1.4.4-1.el5

I need to find if the versions match:
 2.6.18-371.3.1.el5PAE with 2.6.18-238.el5PAE (This is from rpm cmd between the two "-")

Thanks
0
peledc
Asked:
peledc
  • 3
  • 2
3 Solutions
 
xtermCommented:
Try this:

rpm -q ocfs2 --qf '%{version}-%{release}\n'

The output should match the format of uname -r.
0
 
peledcAuthor Commented:
Thanks for the help but this returns:
 1.4.7-1.el5
and not
  2.6.18-238.el5PAE
0
 
peledcAuthor Commented:
I found this to be working:
rpm -qa|grep ocfs2 |grep -v ocfs2-tools| cut -d "-" -f 2,3
0
 
xtermCommented:
Sorry, I didn't have ocfs2-tools installed anywhere to test with.  Nice work getting what you needed though!
0
 
peledcAuthor Commented:
My comment best fit this scenario

Thanks for the help.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now