None of the individual rules in the samplerule file exceed 148 characters in length - far less than the 1024 character limit. You don't say what should be done with the rules if they do exceed that limit.
This is a very simple Bash script that will split your sample on literal "\n" into and array called "rules". It skips lines that exceed 1024 characters and prints an error message:
#!/bin/bash
while read -r line
do
(( count++ ))
if (( ${#line} > 1024 ))
then
echo "Line length limit of 1024 characters exceeded: Length: ${#line} Line no.: $count"
echo "$line"
continue
fi
rules+=($line)
done < <(echo -e "$(<samplerule)")
This variation will truncate the line length without regard to the consequences:
#!/bin/bash
while read -r line
do
rules+=(${line:0:1024})
done < <(echo -e "$(<samplerule)")
If the literal "\n" is not actually in the file and you need to use Bash arrays rather than coding this entirely in AWK, change the line in either version above that says this:
done < <(echo -e "$(<samplerule)")
to say this:
done < <(awk 'BEGIN {RS="OR"} {print $0,"OR"}' samplerule)
if [[ "${rules[${#rules[@]}-1]}" == "OR" ]]
then
unset "rules[${#rules[@]}-1]"
fi
which will split the lines on the "OR".
Edit: Added a command to remove an extra "OR" at the end.