I have a file called TempsModel.txt
which is created as follows:
ls /media/Elise/2811226E69F71131/ModelOutput/* > TempsModel.txt
so it lists all the files in that directory. These files are all compressed netcdf files so it looks like this:
/media/Elise/2811226E69F71131/ModelOutput/20091201_000000.nc.gz
/media/Elise/2811226E69F71131/ModelOutput/20091201_002023.nc.gz
/media/Elise/2811226E69F71131/ModelOutput/20091201_003009.nc.gz
/media/Elise/2811226E69F71131/ModelOutput/20091201_004020.nc.gz
I need this list to not contain the .gz
. How do I remove these three characters?
I tried question Delete the last character of a string using string manipulation in shell script and Remove last character from line
But how do I create a second file TempsModel2.txt
where the list does not contain these last three characters?
ls /media/Elise/2811226E69F71131/ModelOutput/* | sed 's/.gz$//' > TempsModel.txt