Adding the data before file extension

HI ,

I have a file with multiple lines like below, I need to check on column starting with #prototype if it has the .Number.txt extension do nothing else add 1.txt extension.

Source data
Jdbc_app_data :- sample data
#prototype= sample data from test.1.txt
application_id=122135
#prototype= sample data from test.2.txt
target_id=354
#prototype= sample data from test.txt
system_id=222
#prototype= sample data from test.txt
Target Data

Jdbc_app_data :- sample data
#prototype= sample data from test.1.txt
application_id=122135
#prototype= sample data from test.2.txt
target_id=354
#prototype= sample data from test.1.txt
system_id=222
#prototype= sample data from test.1.txt

Regards,
Deepti

Try this

awk '/^#pro/{t=match($5,/[0-9]/,_1);if(t==0){split($5,_2,"."); $5=_2[1]".1."_2[2]}}{print}' file

regards,
Ahamed

sed '/^#prot/s/t\.t/t.1.t/' infile

@ctsgnb: your code will not work if the file doesn't have 't' as last char before extension:

$ cat input
Source data
Jdbc_app_data :- sample data
#prototype= sample data from test.1.txt
application_id=122135
#prototype= sample data from test.2.txt
target_id=354
#prototype= sample data from testhh.txt
system_id=222
#prototype= sample data from testff.txt

$ sed '/^#prot/s/t\.t/t.1.t/' input
Source data
Jdbc_app_data :- sample data
#prototype= sample data from test.1.txt
application_id=122135
#prototype= sample data from test.2.txt
target_id=354
#prototype= sample data from testhh.txt
system_id=222
#prototype= sample data from testff.txt

More general:

sed '/^#prototype/ s/\([^\d]\).txt/\1\.1\.txt/' input

will insert '.1' for a filename with a character other than digit ([^\d]) before '.txt'

awk '/#prototype/&& $(NF-1)!~/[0-9]/ {$NF="1." $NF}1' FS=. OFS=. infile