Ted Yu
2014-04-01 01:44:36 UTC
Hi,
I wanted to search for a small collection of Strings in log file.
Here is sample of Strings:
util.StreamUtils
visibility.DefaultScanLabelGenerator
expression.ExpressionNode
expression.LeafExpressionNode
expression.NonLeafExpressionNode
I found this: sets in linux Bash - Stack Overflow
However, I don't know how to iterate over the set.
declare -A classes
cat $1 | while read line; do
classes[$line]=1
done
for var in "${classes[@]}" do
echo $var
done
I got the following:
./filter-log.sh: line 3: client.Get: syntax error: invalid arithmetic operator (error token is ".Get")
./filter-log.sh: line 6: syntax error near unexpected token `echo'
./filter-log.sh: line 6: ` echo $var'
Help would be appreciated.
I wanted to search for a small collection of Strings in log file.
Here is sample of Strings:
util.StreamUtils
visibility.DefaultScanLabelGenerator
expression.ExpressionNode
expression.LeafExpressionNode
expression.NonLeafExpressionNode
I found this: sets in linux Bash - Stack Overflow
However, I don't know how to iterate over the set.
declare -A classes
cat $1 | while read line; do
classes[$line]=1
done
for var in "${classes[@]}" do
echo $var
done
I got the following:
./filter-log.sh: line 3: client.Get: syntax error: invalid arithmetic operator (error token is ".Get")
./filter-log.sh: line 6: syntax error near unexpected token `echo'
./filter-log.sh: line 6: ` echo $var'
Help would be appreciated.