From: Aragorn on 27 Jul 2010 19:41 On Tuesday 27 July 2010 23:20 in comp.os.linux.misc, somebody identifying as Peter Chant wrote... > no.top.post(a)gmail.com wrote: > >> Someone kindly provided the following very useful one-liner >> to find all <recent> files containing 'a string':- >> >> find ./ -ctime -2 -exec grep -l "a string" {} \; >> >> Now I want command/s to find files containing MULTIPLE strings like: >> "dog", "cat", "fish" > > Hmm, since 'cat' and 'fish' are available commands on my slack install > at least, I see chance for great confusion... "dog" is also a command - it's an improved version of "cat", similar to how "less"[*] is an improved version of "more" - albeit that it's not installed by default on most systems. ;-) [*] There's also an improved version of "less" *and* "more", called "most". :p Gotta love those GNU hackers. ;-) -- *Aragorn* (registered GNU/Linux user #223157)
From: Peter Chant on 27 Jul 2010 20:09 Aragorn wrote: > "dog" is also a command - it's an improved version of "cat", similar to > how "less"[*] is an improved version of "more" - albeit that it's not > installed by default on most systems. ;-) > > [*] There's also an improved version of "less" *and* "more", > called "most". :p Gotta love those GNU hackers. ;-) > Time to renew my C skills - "mostly" an advanced version of "some". (skips every 5th line on average) :-) I'll leave it to the newsgroup to debate "less" versus "fewer"... -- http://www.petezilla.co.uk
From: William Hunt on 28 Jul 2010 00:25 On Wed, 28 Jul 2010, Aragorn wrote: > On Tuesday 27 July 2010 23:20 in comp.os.linux.misc, somebody > identifying as Peter Chant wrote... >> no.top.post(a)gmail.com wrote: [...] >>> Now I want command/s to find files containing MULTIPLE strings like: >>> "dog", "cat", "fish" >> >> Hmm, since 'cat' and 'fish' are available commands on my slack install >> at least, I see chance for great confusion... > > "dog" is also a command - it's an improved version of "cat", similar to > how "less"[*] is an improved version of "more" - albeit that it's not > installed by default on most systems. ;-) for years i've been using a sleazy local script, dog, to strips '#' comments out of text data files: $ cd /usr/local/bin $ cat dog #!/usr/bin/sed -f /^[ ]*#/d /^[ ]*$/d s/[ ][ ]*#.*// $ dog dog /^[ ]*#/d /^[ ]*$/d s/[ ][ ]*#.*// $ -- William Hunt, Portland Oregon USA
From: Grant on 28 Jul 2010 07:48 On Tue, 27 Jul 2010 21:25:43 -0700, William Hunt <wjh(a)prv8.net> wrote: >On Wed, 28 Jul 2010, Aragorn wrote: >> On Tuesday 27 July 2010 23:20 in comp.os.linux.misc, somebody >> identifying as Peter Chant wrote... >>> no.top.post(a)gmail.com wrote: >[...] >>>> Now I want command/s to find files containing MULTIPLE strings like: >>>> "dog", "cat", "fish" >>> >>> Hmm, since 'cat' and 'fish' are available commands on my slack install >>> at least, I see chance for great confusion... >> >> "dog" is also a command - it's an improved version of "cat", similar to >> how "less"[*] is an improved version of "more" - albeit that it's not >> installed by default on most systems. ;-) > >for years i've been using a sleazy local script, dog, >to strips '#' comments out of text data files: > >$ cd /usr/local/bin >$ cat dog >#!/usr/bin/sed -f >/^[ ]*#/d >/^[ ]*$/d >s/[ ][ ]*#.*// >$ dog dog >/^[ ]*#/d >/^[ ]*$/d >s/[ ][ ]*#.*// >$ You might improve that script by changing the operation order: eat comments, eat trailing whitespace, eat empty lines? Grant.
From: William Hunt on 28 Jul 2010 22:07 On Wed, 28 Jul 2010, Grant wrote: > On Tue, 27 Jul 2010 21:25:43 -0700, William Hunt <wjh(a)prv8.net> wrote: >>On Wed, 28 Jul 2010, Aragorn wrote: >>> On Tuesday 27 July 2010 23:20 in comp.os.linux.misc, somebody >>> identifying as Peter Chant wrote... >>>> no.top.post(a)gmail.com wrote: [...] >>$ cd /usr/local/bin >>$ cat dog >>#!/usr/bin/sed -f >>/^[ ]*#/d >>/^[ ]*$/d >>s/[ ][ ]*#.*// >>$ dog dog >>/^[ ]*#/d >>/^[ ]*$/d >>s/[ ][ ]*#.*// >>$ > > You might improve that script by changing the operation order: > eat comments, eat trailing whitespace, eat empty lines? > > Grant. > Thanks, Grant - as always, good Clue from you :*) I'll update my local script package accordingly. I'm not much a fan of sed (prefering awk) and didn't write that, but it works okay, mostly, so I just use it. -- William Hunt, Portland Oregon USA
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: Thunderbird 3 Next: Checking state of inserted DVD media? |