Print the name of each file matched by grep.

Print the name of each file matched by whole line regular expression.

$ grep --files-with-matches --line-regexp "Categories=.*Network.*" /usr/share/applications/*
/usr/share/applications/firefox.desktop
/usr/share/applications/gnome-bluetooth-panel.desktop
/usr/share/applications/gnome-wwan-panel.desktop
/usr/share/applications/google-chrome.desktop
/usr/share/applications/icedtea-netx-javaws.desktop
/usr/share/applications/librewolf.desktop
/usr/share/applications/nm-connection-editor.desktop
/usr/share/applications/org.remmina.Remmina-file.desktop
/usr/share/applications/org.remmina.Remmina.desktop
/usr/share/applications/start-librewolf.desktop
/usr/share/applications/thunderbird.desktop
/usr/share/applications/transmission-gtk.desktop
/usr/share/applications/x2goclient.desktop
/usr/share/applications/xpra-gui.desktop
/usr/share/applications/xpra-launcher.desktop
/usr/share/applications/xpra-shadow.desktop
/usr/share/applications/xpra.desktop

Print the name of each file not matched by whole line regular expression.

$ grep --files-without-match --line-regexp "\[Desktop Entry\]" /usr/share/applications/*
/usr/share/applications/defaults.list
/usr/share/applications/gnome-mimeapps.list
/usr/share/applications/mimeinfo.cache
ko-fi