I'm looking to remove files from a tar archive which match a regex pattern in their filename. My current process is:
tar -tf LC080330242019031901T1-SC20190606111327.tar | grep _b[1-9] |
Where I query the files in the tar. This gives the output:
LC08_L1TP_033024_20190319_20190325_01_T1_b10.tif
LC08_L1TP_033024_20190319_20190325_01_T1_b11.tif
LC08_L1TP_033024_20190319_20190325_01_T1_b2.tif
LC08_L1TP_033024_20190319_20190325_01_T1_b1.tif
LC08_L1TP_033024_20190319_20190325_01_T1_b6.tif
LC08_L1TP_033024_20190319_20190325_01_T1_b8.tif
LC08_L1TP_033024_20190319_20190325_01_T1_b5.tif
LC08_L1TP_033024_20190319_20190325_01_T1_b3.tif
LC08_L1TP_033024_20190319_20190325_01_T1_b4.tif
LC08_L1TP_033024_20190319_20190325_01_T1_b9.tif
LC08_L1TP_033024_20190319_20190325_01_T1_b7.tif
However I cannot for the life of me find the command to then remove this list of files from the tar file.