LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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, 10: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, 10:22 AM   #2
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
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 06:22 PM
Output the result of a command to a file darkarcon2015 Linux - Newbie 1 09-24-2005 06:29 PM
Assign command output to a varible. wilku Linux - Newbie 3 03-26-2005 11:56 AM
BASH Command Result redhatnoob Programming 2 08-19-2004 06:25 PM
command output to varible!!! fooforon Programming 3 02-05-2004 08:41 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:19 AM.

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