Issue
I would like to change the application name in a config file. Name=
has multiple occurrences, but I only want to change the first. For reference, the config file has the following structure:
[Desktop Entry]
Version=1.0
Name=name
Name[ar]=...
[...]
[Desktop Action new-window]
Name=Open a New Window
[...]
What I tried so far is the bash command sed:
sudo sed "0,/Name/s/=.*\$/=Replace/" app_desktop_configs/std_firefox.desktop
which mostly did what I wanted, but also replaces the version number:
[Desktop Entry]
Version=Replace
Name=Replace
Name[ar]=...
[...]
Alternative solution to sed are also welcome :)
Solution
So match exactly Name=
not =.*
sed '0,/^Name=/s/^Name=.*/Name=Replace/'
Answered By - KamilCuk Answer Checked By - Cary Denson (WPSolving Admin)