Skip to content
Permalink
Browse files

iRule to tcl substitution script.

  • Loading branch information...
kugg committed Nov 8, 2018
1 parent 927dcd6 commit 6fc78118a105b09785c3008308c0aa7a520f530e
Showing with 25 additions and 0 deletions.
  1. +25 −0 subst_irule.sh
@@ -0,0 +1,25 @@
#!/bin/bash
# Script to substitute keywords/commands from irule files to make
# them pure tcl. The file will no longer produce the same result
# and will not be equivalent but it will run with tclscan.
if [ $# -ne 2 ]; then
echo "iRule substitution script."
echo "Usage: $0 <source> <destination>"
exit 1
fi
source_filename="$1"
dest_filename="$2"

cp $source_filename $dest_filename

subst='equals/eq,starts_with/=='

OLDIFS=$IFS; IFS=',';
for i in $subst;
do
set -- $i; sed -i -e "s/$1/g" $dest_filename;
done;
IFS=$OLDIFS

sed -i '$ d' $dest_filename
sed -i '1,1d' $dest_filename

0 comments on commit 6fc7811

Please sign in to comment.
You can’t perform that action at this time.