Hi!
Let's say I would like to convert "1", "2", "3" to "a", "b", "c" respectively.
I am new to ksh scripting, specially array.
You can replace the for-loop with something like this:awk -v max_count="$MAXCOUNT" '
$6=="Failed" && $7=="password" && $NF=="ssh2" {
array[$11]++
}
END {
for(ip in array) {
if(array[ip] >= max_count) {
print "ALL:", ip
}
}
}' /var/log/secure
I am making a pipeline of several commands.
This is a part of my shell script.
-----------------------------------
array=(
"mkdir src"
"ls -l | grep tk_ > src/list"
)
len=${#array[*]}
i=0;
while [ $i -lt $len ]; do
echo ${array[$i]}
if !(${array[$i]}); then exit 1; fi;
let i++
Hello All,
In a Bash Script I'm writing I have a section where I loop through a text file that was
outputted by another script. In the text file some of the strings in there are enclosed with
the BOLD "character sequences" (i.e. "\033[1m" ) and the "OFF" sequence (i.e. "\033[0m" ).
Hello All,
I have this script that does stuff like "starting, stopping & restarting" a Daemon Process running on my machine...
My main question is why in part of my code (which you will see below) does the Array Length (i.e.
I'm trying to use the following command:
Code:
awk -v array1=${array1[@]} -f "filename.awk" input.txt
Then within filename.awk I want to access array1[n]. However, awk mistakes array1[2] (the third element of the array) for the input file. How I can pass awk this array?
It also appears that awk scripts can't understand ":-" or ${#var}. Is this correct?
In shell script i have two variables with value
Code:
debit_sal="DOG,HIU,JIU,GYT,PPI,KIU,HUY........."
debit_req='HIU, JIU, HUY, GTR, KOI, ............"
i stored this two in two array
arr=$(echo $debit_sal| tr "," "\n");
arr1=$(echo $debit_req| tr ", " "\n"); #(note second arry has comma with space)
set -A dfArr $arr
set -A drArr
Hi All
I have a doubt and want to be cleared I am using
Code:
@array = (10, 20);
$rarray = \@array;
#print "$rarray\n";
#print "@$rarray\n";
$rr= \$array[0];
#print $$rr;
$rr++;
print $$rr;
As you can see the $rr contains the reference to the first element of the array , now as the definition say array contains the continuous memory location