LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-19-2010, 05:34 AM   #1
maheshp86
LQ Newbie
 
Registered: Jun 2010
Location: mumbai
Posts: 22

Rep: Reputation: 0
how to filter words


hi!!!

pls guide me.


consider the following command

[monitor@lms check]$ mysql -u root -pPassword -e "show master status\G"|grep -v "1. row" | grep Position
Position: 3317310
[monitor@lms check]$

it is giving the output "Position: 3317310", from this how can i filter

only 3317310 ?

Last edited by maheshp86; 08-19-2010 at 05:44 AM. Reason: filtering
 
Old 08-19-2010, 05:41 AM   #2
carltm
Member
 
Registered: Jan 2007
Location: Canton, MI
Distribution: CentOS, SuSE, Red Hat, Debian, etc.
Posts: 703

Rep: Reputation: 99
You could use "sed 's/Position: //'". This uses the stream
editor to replace "Position: " with "".
 
Old 08-19-2010, 05:45 AM   #3
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

By piping the output to awk:
Code:
mysql -u root -pPassword -e "show master status\G"|grep -v "1. row" | grep Position | awk '{ print $2 }'
Kind regards,

Eric
 
Old 08-19-2010, 05:46 AM   #4
maheshp86
LQ Newbie
 
Registered: Jun 2010
Location: mumbai
Posts: 22

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by carltm View Post
You could use "sed 's/Position: //'". This uses the stream
editor to replace "Position: " with "".

sorry

i can't , pls specify clearly
 
Old 08-19-2010, 05:48 AM   #5
maheshp86
LQ Newbie
 
Registered: Jun 2010
Location: mumbai
Posts: 22

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by EricTRA View Post
Hi,

By piping the output to awk:
Code:
mysql -u root -pPassword -e "show master status\G"|grep -v "1. row" | grep Position | awk '{ print $2 }'
Kind regards,

Eric

thanks a lot ,
 
Old 08-19-2010, 05:48 AM   #6
sem007
Member
 
Registered: Nov 2006
Distribution: RHEL, CentOS, Debian Lenny, Ubuntu
Posts: 638

Rep: Reputation: 113Reputation: 113
[EDIT]

Bit late to post same solution suggested by EricTRA

EricTRA you beat me in typing

Last edited by sem007; 08-19-2010 at 05:51 AM.
 
Old 08-19-2010, 05:57 AM   #7
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Quote:
Originally Posted by maheshp86 View Post
thanks a lot ,
Hi,

You're welcome! If you consider your question/problem solved then please mark it as such using the Thread Tools.

@sem007: That's life, sometimes you win and sometimes you loose

Kind regards,

Eric
 
Old 08-19-2010, 06:10 AM   #8
sem007
Member
 
Registered: Nov 2006
Distribution: RHEL, CentOS, Debian Lenny, Ubuntu
Posts: 638

Rep: Reputation: 113Reputation: 113
Quote:
@sem007: That's life, sometimes you win and sometimes you loose
yes EricTRA that's right but i am not here to win anything

This is nice platform to learn new things and share knowledge Thanks to jeremy and all LQ member.

Regards,
 
Old 08-19-2010, 06:12 AM   #9
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Quote:
Originally Posted by sem007 View Post
yes EricTRA that's right but i am not here to win anything

This is nice platform to learn new things and share knowledge Thanks to jeremy and all LQ member.

Regards,
Hi,

I was just kidding! I'm here for the same reason as you are, to learn stuff, share knowledge and help out where I can. Sorry if I somehow offended you with my 'joke'.

Kind regards,

Eric
 
Old 08-19-2010, 06:18 AM   #10
sem007
Member
 
Registered: Nov 2006
Distribution: RHEL, CentOS, Debian Lenny, Ubuntu
Posts: 638

Rep: Reputation: 113Reputation: 113
Quote:
Originally Posted by EricTRA View Post
Hi,

I was just kidding! I'm here for the same reason as you are, to learn stuff, share knowledge and help out where I can. Sorry if I somehow offended you with my 'joke'.

Kind regards,

Eric
nop dear you never hurt me. i mean to say i not here to win but to learn.

it might be language problem because English is not my native language.
 
  


Reply

Tags
filtering



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
Removing white spaces between words and joining the words in a given format Priyabio Linux - General 4 08-20-2009 07:42 AM
How do I create words.db from words.txt using gdbm? kline General 8 12-14-2008 08:48 PM
Can grep filter out words? extrasolar Linux - General 1 07-20-2006 03:14 PM
Filter Email with Certain Words nevarlen Linux - General 2 02-05-2005 04:08 PM
Search and Replace: Asian Words to English Words ieeestd802 Linux - Software 0 10-27-2004 07:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:03 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
Open Source Consulting | Domain Registration