I have a file with line numbers from 1 to 33 with a FS :. I'm using AWK to search through the file line by line. My problem is that when AWK gets to line 10 and above it prints line 1 & 10, 2 & 12 ,etc. Is there a way to match exactly? This is what I have for my script.
file1=/tmp/nsr_groups
file2=/tmp/groups
line_count=`cat $file1|wc -l`
count=1
until (( count > $line_count ))
do
group_name=`awk -F':' '/'"^$count:"'/ {printf $3}' $file1`
cat $file1 |awk '/'"$group_name"'/','name:/' |sort -ur
let count="count + 1"
done
file1=/tmp/nsr_groups
file2=/tmp/groups
line_count=`cat $file1|wc -l`
count=1
until (( count > $line_count ))
do
group_name=`awk -F':' '/'"^$count:"'/ {printf $3}' $file1`
cat $file1 |awk '/'"$group_name"'/','name:/' |sort -ur
let count="count + 1"
done