Using the correct quotes after the sed command will do the trick:
Code:
#!/bin/bash
#
# infile must be given
INFILE="$1"
# Are input/output file provided:
[[ -z ${INFILE} ]] && echo "No input file given. Quiting" && exit 1
TEXT="This is line number :"
for THIS in 1 2 3
do
sed "${THIS}s/.*/${TEXT}${THIS}/" ${INFILE}
echo ""
done
$ cat inputfile
wertwrtwertwertwertwert
sdfgsfdgsdfgsdfgsdfgsdfg
cvxcvbncvbncbncbncvbncvbn
345634563546356354635636
$ ./sed-options.sh inputfile
This is line number :1
sdfgsfdgsdfgsdfgsdfgsdfg
cvxcvbncvbncbncbncvbncvbn
345634563546356354635636
wertwrtwertwertwertwert
This is line number :2
cvxcvbncvbncbncbncvbncvbn
345634563546356354635636
wertwrtwertwertwertwert
sdfgsfdgsdfgsdfgsdfgsdfg
This is line number :3
345634563546356354635636
$