how to append string before print text using cat?

I have a txt file which contains many filename endswith ".txt":

kk@ubuntu:/data1/base$ cat test_set.txt 
002d1cb89d39170a6711b7f78fc48baf.txt
00556f4d84fd7bb1db357d3e1731f692.txt
03028fa09ed1c1121eca3cb872952b45.txt
0389668432226660125cc27194d67512.txt
066a19c74c4544cd341a8136c8f03b1a.txt

Now I want to print the same text except replacing the ".txt" postfix with ".jpg", but I don't know how to do it only with linux commands. I've found that using "cut" and pipeline can get rid of ".txt", but appending ".jpg" to every printed line keeps unresolved. Any way to deal?


You can find and replace the text using the below command.

sed -i 's/.txt/.jpg/g' test_set.txt

This command will replace ".txt" to ".jpg". Hope this will solve your problem.