Find and delete lines in .desktop files
Posted: Thu Aug 06, 2020 5:26 pm
.desktop files contain loads and loads of lines that are not needed.
e.g:-
GenericName[es]=Navegador web
Comment[ca]=Accedeix a Internet
Name[fr]=Nouvelle fenêtre
ad nauseam - take a look at the google-chrome.desktop attached and you'll see what I mean.
I don't need any of these language entries and in the past I used to manually clean up those that I used the most to improve execution times. That was back in the days of a 486 with 500mb RAM and an 80gb hard drive!!!!
Now, I have tried using various combinations of sed to find and remove these but I keep running into the same problem and that is the [ ]s which are seen as regex entries. Obviously what I want to do is find any line that contains Name[anything]= or Comment[anything]= and so on and delete the line.
This would leave lines like
Comment=Access the Internet intact - which is what I want.
I have searched for finding lines with variables or wildcards but keep stumbling on the square brackets. Anyone got any ideas please? I have tried various find utilities but this needs to be programmatic to handle the number of files involved.
Thanx - bin
e.g:-
GenericName[es]=Navegador web
Comment[ca]=Accedeix a Internet
Name[fr]=Nouvelle fenêtre
ad nauseam - take a look at the google-chrome.desktop attached and you'll see what I mean.
I don't need any of these language entries and in the past I used to manually clean up those that I used the most to improve execution times. That was back in the days of a 486 with 500mb RAM and an 80gb hard drive!!!!
Now, I have tried using various combinations of sed to find and remove these but I keep running into the same problem and that is the [ ]s which are seen as regex entries. Obviously what I want to do is find any line that contains Name[anything]= or Comment[anything]= and so on and delete the line.
This would leave lines like
Comment=Access the Internet intact - which is what I want.
I have searched for finding lines with variables or wildcards but keep stumbling on the square brackets. Anyone got any ideas please? I have tried various find utilities but this needs to be programmatic to handle the number of files involved.
Thanx - bin