D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] grep and dreadful command line skills

 

On Sat, 21 Nov 2009, Simon Robert wrote:

Hello all

I use a rather great application called Alexandria to look after my
extensive (vastly inconvenient according to some around here) collection
of SF books.

It even works with the extremely odd, but $5 on ebay "cuecat" scanner
for ISBN codes. Downloads cover and details from Amazon. Worthwile
looking up the "cuecat" just for amusement

- the dubious distinction as one of "The 25 Worst Tech Products of All
Time"

- fails to solve a problem which never existed

http://en.wikipedia.org/wiki/CueCat

Anyhow the point of this mail is that although fab Alexandria will not
delete entries. (this project moves at glacial speed, but the likelyhood
of me learning Ruby and solving this problem before it forks is not
great). The book details are held in easy to read database files and I
want to be able to track down a file so I can delete it.

A grep command like "grep Transition *.yaml" would be great, except as
far as I can figure one needs to specify a list of files. Is the a way
of using grep which would allow me to do the above? Or a similar
command?

Doesn't that just do what you want? Or are you looking to descend directories, etc?

Traditionally: (well, my tradition!)

  find . -type f -name \*.yaml -exec grep -l Transition {}  \;

Although grep these days has been bloated with it's own directory recursion and filename globbing, which is utterly pointless IMO when the tools to do this already existed, but newbie command-line weenies couldn't be bothered to learn them </rant>, but there you are:

  grep -l -r --include='*.yaml' Transition .

might work for you too.

Gordon

--
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html