Say I have a file with contents for example:
Code: Select all
/root/.local/share/applications/Brave-Portable64.desktop
/root/.local/share/applications/vlc.desktop
/root/.local/share/applications/google-chrome.desktop
/usr/share/applications/abiword.desktop
/usr/share/applications/geany.desktop
/usr/share/applications/evince.desktop
/usr/share/applications/deadbeef.desktop
/usr/share/applications/vlc.desktop
/usr/share/applications/google-chrome.desktop
/usr/share/applications/lxrandr.desktop
I'd like to modify by keeping only the (that are double above) .desktop entries (vlc.desktop and google-chrome.desktop in this case) that are in /root/.local/share/applications/ , so that it becomes:
Code: Select all
/root/.local/share/applications/Brave-Portable64.desktop
/root/.local/share/applications/vlc.desktop
/root/.local/share/applications/google-chrome.desktop
/usr/share/applications/abiword.desktop
/usr/share/applications/geany.desktop
/usr/share/applications/evince.desktop
/usr/share/applications/deadbeef.desktop
/usr/share/applications/lxrandr.desktop
(without vlc.desktop and google-chrome.desktop from /usr/share/appications/)
I know there's option to sort -u by column number (with delimiter /), but here the column numbers are different from each other and can't make it work in some way.