![]() |
|
|
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 |
| Need Help with awk and arrays | fusionX | Shell Programming and Scripting | 7 | 02-11-2008 06:41 PM |
| arrays in shell script | melanie_pfefer | Shell Programming and Scripting | 3 | 05-18-2007 09:36 AM |
| Script to Monitor databases help with arrays | nelmest | Shell Programming and Scripting | 1 | 09-05-2005 11:50 PM |
| KSH and arrays | whited05 | Shell Programming and Scripting | 1 | 06-24-2005 01:07 PM |
| CGI passing arrays/hashes to another CGI script | WIntellect | Shell Programming and Scripting | 2 | 01-13-2003 11:22 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
ksh script - arrays
hello all.. I have been browsing / searching through the forum and have yet not been able to find what I was looking for.
I am fairly new to ksh and my task is to create a function that reads in an input file: ***************** 2 3 1 abc def ghi /dev/sid/ ***************** (NOTE: the spaces between data sets above DOES NOT exist but it's only there for ease of understanding) the first line (2 in this case) consists of the numbert of data sets followed by the number of parameters in the 2 datasets (3 and 1). (abc,def,ghi) are the parameter values for the first data set and (/dev/sid) is tha value for the second data set. The above 2 data sets need to be scanned into different arrays and hence this is what i came up with: cat ${INPUT_FILE} | while read LINE #processing steps for all common parameters, assign each common parameters to the array variable COMMON_PARAMETER_CONTENT do if [[ $count -le $PARAMETER_CONTENT ]] then SUBSET_ARRAY[count]=$LINE ((count+=1)) continue fi i = 0 countA = 0 countB = 0 while [[ $countB -l (SUBSET_ARRAY[i]) ]] //need a check here to prevent overflowing..! do while [[ $countA -le (SUBSET_ARRAY[i]) ]] do [I] SUBSETDATA + "i" = $LINE ((countA+=1)) ((DATA_TOTAL_LINE+=1)) done ((i+=1)) countA = 0 done My question is.. will the highlighted, Italicised line work? Can i loop thru' and put the diff datasets into diff arrays using the "string join" ? Thanks in advance and sorry for the long post. Sid |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|