grep or fgrep ?

Alain -- ubuntu at
Sat Sep 23 21:35:23 UTC 2006

From/De [Richard]
On/Le [2006/09/23 15:15]
> Have dozens of files in a folder and want to extract the following:
> all the files end with .desktop
> eg: google.desktop
> what to extract ( name of file ) and search string "Keys"
> eg:	fgrep "Keys" *.desktop ( bring back only one file ) there a dozens of 
> files... pgpkeys.desktop:Keys=pgp,pgpkeys
> So, this tells me that pgpkeys.desktop "Keys"(string) is = to pgp
> and google.deskotp "Keys" is = to gg
> So, as you can see, I am trying to make a list of Keys as a output to screen 
> or a text file for printing. This are the web shortcuts.
> So, any grep guru's ?
> Thanks-
> Rich

Yep, I'm pretty good at grep, fgrep, egrep...
What I'm not good at is reading your question.

grep is the 'normal' grep.

fgrep does not search for patterns but plain strings, it is faster, but 
as I see it speed is not really a concern for you (I assume your files 
are small - only a few kBs at most as opposed to MBs or more; and there 
are not many - not more than a few dozen).

Your command [fgrep "Keys" *.desktop] should work perfectly well if all 
files are in the directory in which you carry out that search. This 
assumes that 'Keys' is spelt exactly this way in all files (same case).
If you want to ignore cae, type: fgrep -i "Keys" *.desktop


More information about the ubuntu-users mailing list