Watael,
thanks for the quick reply.
That said, your reply is a bit over my head.

I haven't even tested it yet because I'd really like to understand
how it's doing what it's doing.... Mind if I ask some questions?
I understand that
Code:
[ -f /proc/self/fd/7 ] || exec 7<FileA.txt
will do
Code:
[ -f /proc/self/fd/7 ]
OR
Code:
exec 7<FileA.txt
matching the first condition will negate the rest of the line. But I'm a little confused about what those two choices actually mean. This is the first time I've heard of the /proc/self/fd/* files. In looking at my system, I have a 0, 1, 2, and 255 in that directory, but no 7. Would this be created at runtime? Mr. Google tells me that 0, 1, and 2 represent stdin, stdout and stderr, respectively, but doesn't have any info on 7 other than that 3-9 is an available range to use. My guess on this is that the script will check to see if /proc/self/fd/7 is a regular file, and when it finds that it doesn't exist (on my system), it will go to the second option. (Am I close?)
The second option is somewhat new to me as well, but I think it redirects FileA.txt to /proc/self/fd/7, yes?
The rest of the function:
Code:
if read -u7 lineA
then if [ "${lineA%% *}" = "$2" ]
then echo "$1"
sed -r 's/(.*>)([0-9].{1,3}){1,3}[0-9]{1,3}(<.*)/\1'"${lineA##* }"'\3/' <<< "$1"
else myFunc "$1"
fi
else exec 7<&-
fi
I kind of get, but I'm confused by the "lineA%%" and the "lineA##" What do the %% and ## represent?
In the while statement:
Code:
while read lineB
do IP=$(sed -r 's/.*>(([0-9].{1,3}){1,3}[0-9]{1,3})<.*/\1/' <<<"$lineB")
[[ $IP =~ ^([0-9].{1,3}){1,3}[0-9]{1,3}$ ]] && {
myFunc "$(sed 's/[0-9]*%/30%/' <<< "$lineB")" "$IP"
} || echo "$lineB"
done <testreplace.html
What is the meaning of the "triple less-than" (i.e. <<<)?
Just trying to get an understanding of how the script works. Thanks for the help so far!
Mike