Hai,
I have got a small requirement in my script. and i am using bash shell. I need to add a dot (.) for some particular line in a file. Say for example,
$Cat rmfile
1 This is line1
2 This is line2
3 This is line3
O/p should be :
$Cat rmfile
1 This is line1
2 This is line2. # Here at line number 2nd i need to add DOT.
3 This is line3
Here is what i have tried but didnt work
j=`sed -n $prline'p' $rmfile` # Here i am taking the line at particular number
i=`echo $j | sed 's/$/./'` # here am appending DOT to it and using below # two operations. One is sed to replace. another is awk. Neither is working
awk '{if(NR == $a) {print $i >> $rmfile}}' #using awk
sed -i 's/"$j"/"$i"/g' $rmfile # using sed to replace
Please suggest me the proper way...
Thank you