The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
[csh] How to capture output from a command and pass it on to a variable? machinogodzilla Shell Programming and Scripting 3 05-11-2008 09:36 AM
ls command output to variable in script dsrookie UNIX for Dummies Questions & Answers 1 03-10-2008 04:14 PM
Assigning output of command to a variable oma04 Shell Programming and Scripting 5 06-27-2006 12:11 PM
redirect command output to variable hugow UNIX for Dummies Questions & Answers 1 06-22-2005 06:43 AM
Command output to a variable. videsh77 Shell Programming and Scripting 8 12-16-2004 06:06 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 06-02-2008
muaz muaz is offline
Registered User
  
 

Join Date: May 2008
Posts: 14
get characters from output of a command in a variable

Hi,

i have two questions, I am new to programming
1. I have an output of a command and i want to get some specific part of it in a variable. i am trying

sr=`some comand xyz| grep 'Last Changed Rev:' | cut -c19-`
now variable sr gets a end of line character at end.

output of the command is

Date: yyyy-mm-dd
---------

abc
xyz
Last Changed Rev: 10
abc
-------------


i want to get this 10 in the variable sr. i dont know the number length in advance.

2. Also the comand returns multiple lines output, how to get complete text in between

abc
xyz
Last Changed Rev: 10
abc


in another variable?
please help!

Thanks in advance..

Last edited by muaz; 06-02-2008 at 08:18 AM..
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:37 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0