![]() |
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 |
| incorrect array values | jhillier | UNIX for Dummies Questions & Answers | 6 | 01-04-2008 04:44 AM |
| printing all array values using dbx 7.2.1 | JamesGoh | High Level Programming | 1 | 12-18-2007 04:07 PM |
| to assign cut values to an array | Syms | UNIX for Dummies Questions & Answers | 6 | 10-29-2007 06:42 AM |
| Assigning values to an array | yongho | UNIX for Dummies Questions & Answers | 4 | 07-13-2005 09:49 PM |
| array values in a command | eeisken | Shell Programming and Scripting | 3 | 06-22-2005 05:49 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Array values treated as one
I want each integer to be a value/element in the array, however the string is being treated as one. How can I stream these into distinct values?
PSF6INDEX=`(snmpwalk -v 2c -c 'H0meru!es' ${SWITCH[3]} .1.3.6.1.2.1.2.2.1.2 | grep 'GigabitEthernet[3-9]' | sed 's/IF-MIB::ifDescr\.//g' | awk '{print $1}' | tr '\n' ' ')` output is: 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 echo ${PSF6INDEX[0]} output is: 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
![]() |
| Bookmarks |
| Tags |
| array, extract, string |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|