![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Regardign strtok() output directing to 2-D string array | SankarV | High Level Programming | 3 | 04-28-2008 06:48 AM |
| bash:awk output into an array | phamp008 | Shell Programming and Scripting | 2 | 03-16-2008 02:14 AM |
| create array holding characters from sring then echo array. | rorey_breaker | Shell Programming and Scripting | 5 | 09-28-2007 05:42 AM |
| output of an array | ragha81 | Shell Programming and Scripting | 3 | 03-22-2007 01:30 PM |
| formating array file output using perl | seismic_willy | Shell Programming and Scripting | 4 | 03-21-2007 11:23 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
move output of awk to array
Hi experts,
I have a the following awk command, awk '{print $1}' /users/jon/list4.txt. The output is 123 787 888 ... ... I want to move the output to array using shell programming. My shell is tcsh. Is it possible to move to array using shell porg? I know its possible in perl. Let me know Thanks Amit |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
with this data would be populated in the array
Code:
awk '{ arr[$1] }' filename
|
|
#3
|
|||
|
|||
|
Code:
# array=$(awk '{print $1}' /users/jon/list4.txt)
# for items in $array; do echo $items; done
|
|
#4
|
|||
|
|||
|
Quote:
Thanks much for the help. One doubt, How do I print the array? if I use this awk '{ arr[$1] }' filename Thank Amit |
|
#5
|
|||
|
|||
|
Quote:
when I executed, # array=$(awk '{print $1}' /users/jon/list4.txt) # for items in $array; do echo $items; done syntax error at line 21: `array=$' unexpected |
|
#6
|
|||
|
|||
|
Code:
array=`awk '{print $1}' /users/jon/list4.txt`
|
|
#7
|
|||
|
|||
|
Hi,
Thanks again, one more doubt, How do I access the value in array(6). Thx amit |
|||
| Google The UNIX and Linux Forums |