Delete characters from each line

Hi,

I have a file that has data in the following manner,

tt_0.00001.dat 123.000
tt_0.00002.dat 124.000
tt_0.00002.dat 125.000

This is consistent for all the entries in the file. I want to delete the 'tt_' and '.dat' from each line. Could anyone please guide me how to do this using awk or sed?

Thanks.

Try:

sed 's/tt_\(.*\)\.dat/\1/' infile
1 Like

Cheers! that worked.