LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-14-2010, 08:14 AM   #1
anurupr
Member
 
Registered: Mar 2010
Posts: 71

Rep: Reputation: 16
question on grep


i need to get the Serial Number of my motherboard . i used dmidecode to get the serial number. but obviously i needed only the serial number and not the whole details. so i used grep to get only serial number but the problem is i get 3 occurences of "serial number " and only one of the occurences actually has the serial number with it.

this is the code that i used

Code:
sudo dmidecode|grep -i 'Serial Number'
and this is the output that i get

Serial Number:
Serial Number: WYWU54401953
Serial Number:


how do i get only that one occurence?

thanx in advance
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 03-14-2010, 08:29 AM   #2
troop
Member
 
Registered: Feb 2010
Distribution: gentoo, arch, fedora, freebsd
Posts: 379

Rep: Reputation: 96
dmidecode |grep "Base Board Information" -A 5 | grep "Serial Number" | awk '{print $3}'
 
2 members found this post helpful.
Old 03-14-2010, 08:36 AM   #3
anurupr
Member
 
Registered: Mar 2010
Posts: 71

Original Poster
Rep: Reputation: 16
thanx !it works
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] grep question aihaike Programming 3 07-28-2009 12:43 PM
using grep (question) graziano1968 Linux - General 5 02-12-2009 03:53 AM
grep question sudz28 Linux - Newbie 4 01-21-2009 07:13 PM
grep question torrent478 Linux - Newbie 2 10-08-2008 06:50 PM
grep question djgerbavore Linux - Newbie 7 07-07-2004 07:11 AM


All times are GMT -5. The time now is 12:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration