Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 07-04-2012
Registered User
 
Join Date: Jul 2012
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Java How to store/read multiple values from a varible

Hi,
when I enter '
Code:
ps -ef| grep process_name'/'psu | grep process_name

', i am getting multiple number of lines output( i mean multiple no of processes).how can i store it one by one and echo it in the same way(one by one).

part of script is


Code:
var1=$(remsh hostname -l username ps -ef|grep process_name |grep -v grep)
echo $var1

i am getting the output in a single line.

Last edited by Scrutinizer; 07-05-2012 at 01:25 AM.. Reason: code tags
Sponsored Links
    #2  
Old 07-05-2012
itkamaraj's Avatar
^Kamaraj^
 
Join Date: Apr 2010
Posts: 3,025
Thanks: 33
Thanked 647 Times in 625 Posts
try echo with double quotes


Code:
 
echo "$var1"

Sponsored Links
    #3  
Old 07-08-2012
Registered User
 
Join Date: Jul 2012
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
thank you.
it worked
Sponsored Links
Closed Thread

Tags
multiple values, variable

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Read multiple values from sqlplus in perl Pratik4891 Shell Programming and Scripting 4 08-26-2011 01:25 PM
AWK: read values from file1; search for values in file2 Bubnoff Shell Programming and Scripting 2 12-01-2009 06:18 PM
trouble using read to store values in variables from command output ProGrammar UNIX for Dummies Questions & Answers 2 01-09-2009 10:09 AM
split varibles and store fields into shell varible array gratus Shell Programming and Scripting 3 10-11-2007 02:50 PM
Using varible/varible substitution in Perl/sed Search & Replace Breen Shell Programming and Scripting 3 05-08-2002 05:45 AM



All times are GMT -4. The time now is 06:31 AM.