LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 03-10-2009, 11:19 AM   #1
mkiler
LQ Newbie
 
Registered: Nov 2007
Posts: 22

Rep: Reputation: 15
command result as varible


Hi
I'm trying display only a few information from result returned by script.

My reslult is like:

PHP Code:
backends:0 commits:1837 rollbacks:3 read:0 hit:0 ret:0 fetch:0 ins:0 del:0 dbname:postgres 
and I need display only backends:0 (and later make rrd file).

How to division result to part?
 
Old 03-10-2009, 11:22 AM   #2
crabboy
Moderator
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,823

Rep: Reputation: 120Reputation: 120
provided that backends is always the first field you can do this:
Code:
$ echo "backends:0 commits:1837 rollbacks:3 read:0 hit:0 ret:0 fetch:0 ins:0 del:0 dbname:postgres" | cut -d ' ' -f1
backends:0
 
  


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
python - getting command result Hewson Programming 1 08-01-2007 07:22 PM
Output the result of a command to a file darkarcon2015 Linux - Newbie 1 09-24-2005 07:29 PM
Assign command output to a varible. wilku Linux - Newbie 3 03-26-2005 12:56 PM
BASH Command Result redhatnoob Programming 2 08-19-2004 07:25 PM
command output to varible!!! fooforon Programming 3 02-05-2004 09:41 PM


All times are GMT -5. The time now is 05:17 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration