![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| Assigning values to an array via for/while loop | fiori_musicali | Shell Programming and Scripting | 2 | 11-24-2008 11:01 PM |
| Assigning the values to an Array | kkraja | Shell Programming and Scripting | 1 | 08-11-2008 06:28 AM |
| string manipulating | psalas | UNIX for Dummies Questions & Answers | 9 | 04-15-2008 10:00 AM |
| assigning values to a variable | trichyselva | UNIX for Dummies Questions & Answers | 3 | 12-14-2007 01:55 AM |
| Assigning values to an array | yongho | UNIX for Dummies Questions & Answers | 4 | 07-13-2005 08:49 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
retreiving and assigning values and manipulating string in a for loop
Hi
I am new to shell scripting and i am preparing a script. for now i am work on a sub part of it..but i am unable to make it work. --- the test code that i am working on -------------------------- IFS="" Sample_eve=`psg proc_s | grep tY` n=0 for line in $Sample_eve do n=`expr $n + 1` Sam$n=$(`echo $line |awk -F" " {print $5}' |awk -F":" '{print $2}'`) echo $Sam$n done ---------------------------- what i am trying to this is.. list all the process named proc_s that are currently running and are on the machine tY.. populate them in the variable Sample_eve. and then access each line from the Sample_eve and process them on an individual basis. but it is not happening ..for loop only goes through once..if i do not set IFS="" then line takes word by word data from the $Sample_eve...by which i cannot get seperate start time for each process. (it runs 35 times for 4 lines..i want to make it run only 4 time for 4 line). i am doing `echo $line |awk -F" " {print $5}' |awk -F":" '{print $2}'` ..so as to get the start time for each process in minutes..then i am assigning it into array Sam so as to get the start Minute for each process. but getting an output error like this.. for this array assignment as Test[9]: 04^J28^J04^J09: not found. 04, 28,04,09 are correctly shown they are the minutes ..but is not in a proper manner. i am stuck with this thing .. please help me. I am unable to make the code work. i am using the korn shell. thanks |
| Bookmarks |
| Tags |
| awk, cut, for each, for loop |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|