Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


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

Rep: Reputation: 15
command result as varible

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
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:
$ echo "backends:0 commits:1837 rollbacks:3 read:0 hit:0 ret:0 fetch:0 ins:0 del:0 dbname:postgres" | cut -d ' ' -f1


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 > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:46 PM.

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