Unix questions - Re: Using the output from grep to copy files to another location - Related

This is Interesting: Free IT Magazines  
Home > Archive > Unix questions > July 2006 > Re: Using the output from grep to copy files to another location - Related





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: Using the output from grep to copy files to another location - Related
iforone

2006-07-19, 7:25 pm


Major wrote:
> woodie@webfoot.net wrote:
> how about instead of redirection to a file piping to another xargs -J %
> mv % newdir


Hi all;
[ Hope I'm not hijacking ]

I have a similar related issue that hopefully you guys can enlighten me
with the solution.

Mine; has more to do with using the 'find' command correctly/accurately
(perhaps in conjunction with 'grep'?) - I'm a bit overwhelmed at the
size of the options (man find, man grep) and have reviewed the related
man pages for some time. Perhaps I need to expand into 'xargs' et al?

For ex.;
I'm trying to search my locally stored cache of lg (linuxgazette
archives). Say I'd like to find all the articles (html files) that
relate to (contain the keywords) "mouse driver".

I know which DIR the files are in -- On Debian Sid, it's
"/usr/share/doc/lg..." and beneath (see Examples below) -- and the
Online version is actually very easy for searching
www.linuxjournal.com, but being that this Debian install is LOADED with
/doc stuff, I'd like to learn to be able to search FILES' contents at
will ;-)

I know about 'grep' (though I'm not in full command of every option I
can use/call) -- but I do use it for various 'dmesg' , log file
searches, 'dpkg', etc...

Anyway;
I'll need to search many subDirs directly beneath
*/usr/share/doc/lg*.... and inside all the /issueNN subDirs (and
_their_ html files within) that reside beneath this one;

Note;
:/usr/share/doc/lg$ ls | grep issue
issue01to08
issue09
issue10
issue11
issue12
issue13
issue14
[...]
issue97
issue98
issue99

Here's a better ex;
(Looking inside one of the many "issueNN" subDirs)

:/usr/share/doc/lg$ ls -l /usr/share/doc/lg/issue09

total 100
-rw-r--r-- 1 root root 3852 2002-11-29 22:45 binstats.html
-rw-r--r-- 1 root root 6813 2002-11-29 22:45 filerunner.html
drwxr-xr-x 2 root root 4096 2002-08-19 14:53 gx
-rw-r--r-- 1 root root 2444 2006-06-07 18:32 index.html
-rw-r--r-- 1 root root 3383 2002-11-29 22:45 lg_backpage09.html
-rw-r--r-- 1 root root 9500 2002-11-29 22:45 lg_bytes09.html
-rw-r--r-- 1 root root 10481 2002-11-29 22:45 lg_mail09.html
-rw-r--r-- 1 root root 12047 2002-11-29 22:45 lg_tips09.html
-rw-r--r-- 1 root root 14895 2002-11-29 22:45 newsserver.html
-rw-r--r-- 1 root root 12353 2002-11-29 22:45 staroffice.html
-rw-r--r-- 1 root root 5646 2002-11-29 22:45 yodl.html

We find an INDEX.html file for in each "issueNN" dir ..which is
basically an html version of a Table of Contents, containing the
links to each Article in that Month's issue.

Those links are listed as separate html files (respectively) as
you can see (binstats.html, filerunner.html, etc).

How can I search/locate pluck out ANY/ALL keywords for "mouse driver"
is ALL "issues" ?? I ask as a *two word search* (separated with white
space) since a One word search's syntax won't require whatever required
backticks [`] or single or double-quotes that are required/necessary
when performing multi-word searches.

I have NO PROB using 'sudo', to run as root, any command line you can
enlighten me with -- as my /etc/sudoers file is edited to allow me to
do
so easily ;-)

Thanks All for any suggestions you can give me...

Regards

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com