Re: Finding files not present (challenge to your intelligence)
> > > Not of all files. Of files searchable by `nobody.nogroup'. > > > You can run updatedb manually to get a list of all files. Look at the > > options in the info page for more information. > > Actually, you can run updatedb by hand and keep the database private to > root in some other protected directory. On my stand-alone machine at home, I get all files by making this change to /etc/cron.daily/find: #cd / && updatedb --localuser=nobody 2>/dev/null cd / && updatedb 2>/dev/null -- ...RickM...
Re: Finding files not present (challenge to your intelligence)
On Wed, 2 Apr 1997, Kevin Dalley wrote: > > : updatedb generates a database of all file names on the system. (It > > : only runs for a few minutes for my system.) runs quite a while on my 468 33 ;) > > Not of all files. Of files searchable by `nobody.nogroup'. > You can run updatedb manually to get a list of all files. Look at the > options in the info page for more information. Actually, you can run updatedb by hand and keep the database private to root in some other protected directory. --David - LINUX: the FREE 32 bit OS for [345]86 PC's available NOW! David B Teague | User interface copyrights & software patents make [EMAIL PROTECTED] | programing a dangerous business. Ask me or [EMAIL PROTECTED] Mossad data encryption munitions Serbian hydrazine ammonium nitrate fuel oil
Re: Finding files not present (challenge to your intelligence)
Heiko Schlittermann <[EMAIL PROTECTED]> writes: > > > --AqsLC8rIMeq19msA > Content-Type: text/plain; charset=us-ascii > > On Mar 28, Kai Grossjohann wrote > : > Eloy A Paris writes: > : > : Eloy> I was given a text file containing one file name (no full path > : Eloy> name) per line. My task consists of searching the entire > : Eloy> filesystem and generate a list of the files that are NOT > : Eloy> present. > : > : updatedb generates a database of all file names on the system. (It > : only runs for a few minutes for my system.) > > Not of all files. Of files searchable by `nobody.nogroup'. > You can run updatedb manually to get a list of all files. Look at the options in the info page for more information. -- Kevin Dalley [EMAIL PROTECTED]
Re: Finding files not present (challenge to your intelligence)
On Mar 28, Kai Grossjohann wrote : > Eloy A Paris writes: : : Eloy> I was given a text file containing one file name (no full path : Eloy> name) per line. My task consists of searching the entire : Eloy> filesystem and generate a list of the files that are NOT : Eloy> present. : : updatedb generates a database of all file names on the system. (It : only runs for a few minutes for my system.) Not of all files. Of files searchable by `nobody.nogroup'. Heiko -- email : [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] pgp : A1 7D F6 7B 69 73 48 35 E1 DE 21 A7 A8 9A 77 92 finger: [EMAIL PROTECTED] [EMAIL PROTECTED] pgptCowrkesLU.pgp Description: PGP signature
Re: Finding files not present (challenge to your intelligence)
> Eloy A Paris writes: Eloy> I was given a text file containing one file name (no full path Eloy> name) per line. My task consists of searching the entire Eloy> filesystem and generate a list of the files that are NOT Eloy> present. updatedb generates a database of all file names on the system. (It only runs for a few minutes for my system.) "locate foo" searches for all files names with a "foo" substring. The status code is 0 if at least one file was found, 1 otherwise. (Actually, "foo" is a shell pattern with "*" and "?" wildcards. Read the man page for details.) Does this get you closer to the solution? kai -- I wish my mouth had a backso^Hpace key.
Re: Finding files not present (challenge to your intelligence)
On Wed, 26 Mar 1997, Philippe Troin wrote: > Which can be abbreviated with zsh to: > comm -1 -3 <(sort searchlist) <(find -type f -printf "%f\n" | sort) > Hop ! No more cluttering, no more intermediate files. > I love zsh's redirection ! Bash can also do that..! =b -- Nicolás Lichtmaier.- | From Buenos Aires, [EMAIL PROTECTED] | Argentina!
Re: Finding files not present (challenge to your intelligence)
On Wed, 26 Mar 1997 16:39:39 +0100 Heiko Schlittermann ([EMAIL PROTECTED]) wrote: > find -type f -printf "%f\n" | sort > files.exist > sort < searchlist > files.search > comm -1 -3 files.exist files.search Which can be abbreviated with zsh to: comm -1 -3 <(sort searchlist) <(find -type f -printf "%f\n" | sort) Hop ! No more cluttering, no more intermediate files. I love zsh's redirection ! Phil.
Re: Finding files not present (challenge to your intelligence)
Eloy A. Paris wrote: > > Hi Martin, > > > How about using find and generate a list of ALL files, then "grep > > `indivual_lines_from_your_list` list_of_ALL_files" and checking grep's > > return value? > > Well, what I am doing right now is generating a list of the files that > are present (using find and redirecting its output to a file). Later, > I search this file for files not in my original list, so I know which > files are missing. I am using Perl to do this. > You know, perl is a fine language, it's true. But I think that perl has made many people think that awk, find, and grep are now "obsolete". Think again. Heres one solution to your problem: (I'm asssuming that the list of files is in a file called "searchlist") (WARNING: I'm sending this with Netscape, and it will probably wrap the lines for me but this command is all one line--although it needn't be with a few judicious '\'s) grep -v $(find / \( $(awk '{if (s != 0) { print " -o " } ; printf "-name %s", $1 ; s = 1 }' searchlist ) \) -printf '-e %f\n' ) searchlist Never doubt the power of bash/grep/awk/find! -- Jens B. Jorgensen [EMAIL PROTECTED]
Re: Finding files not present (challenge to your intelligence)
Hi, thank you very much for your solution; it is very sharp. I was doing things the hard way. I like the shell solution very much. Regards, Eloy.- > On Mar 26, Eloy A. Paris wrote > : Hi, > : > : I was given a text file containing one file name (no full path name) > : per line. My task consists of searching the entire filesystem and > : generate a list of the files that are NOT present. > > 1. The perl solution: > --- > #!/usr/bin/perl > # * probably overkill, if your file list > # is rather short. > # * probably storing the existing files in a @Array > # and grepping is faster > # * probably a shell line with sort / uniq / comm would > # do the same job > > # generate a list of existing files > open(IN, "find . -type f -printf \"%f\n\"|") or die; > while() { chomp; $Files{$_} = 1; } > > # read in the search list and see, the file exists > open(IN, "searchlist") or die; > while () { chomp; $Files{$_} or print "Missing: $_\n"; } > > > 2. The Shell solution > > > find -type f -printf "%f\n" | sort > files.exist > sort < searchlist > files.search > comm -1 -3 files.exist files.search > > Heiko Schlittermann > - > Heiko Schlittermann / Internet & Unix-Support > Kamenzer Str. 52 D-01099 Dresden > Voice: +49-172-7909055 Mail: [EMAIL PROTECTED] > -- Eloy A. Paris Information Technology Department Rockwell Automation de Venezuela Telephone: +58-2-9432311 Fax: +58-2-9430323
Re: Finding files not present (challenge to your intelligence)
On Mar 26, Eloy A. Paris wrote : Hi, : : I was given a text file containing one file name (no full path name) : per line. My task consists of searching the entire filesystem and : generate a list of the files that are NOT present. 1. The perl solution: --- #!/usr/bin/perl # * probably overkill, if your file list # is rather short. # * probably storing the existing files in a @Array # and grepping is faster # * probably a shell line with sort / uniq / comm would # do the same job # generate a list of existing files open(IN, "find . -type f -printf \"%f\n\"|") or die; while() { chomp; $Files{$_} = 1; } # read in the search list and see, the file exists open(IN, "searchlist") or die; while () { chomp; $Files{$_} or print "Missing: $_\n"; } 2. The Shell solution find -type f -printf "%f\n" | sort > files.exist sort < searchlist > files.search comm -1 -3 files.exist files.search Heiko Schlittermann - Heiko Schlittermann / Internet & Unix-Support Kamenzer Str. 52 D-01099 Dresden Voice: +49-172-7909055 Mail: [EMAIL PROTECTED] pgpsQOuVF8mnU.pgp Description: PGP signature
Re: Finding files not present (challenge to your intelligence)
Hi Martin, > How about using find and generate a list of ALL files, then "grep > `indivual_lines_from_your_list` list_of_ALL_files" and checking grep's > return value? Well, what I am doing right now is generating a list of the files that are present (using find and redirecting its output to a file). Later, I search this file for files not in my original list, so I know which files are missing. I am using Perl to do this. Regards, E.- -- Eloy A. Paris Information Technology Department Rockwell Automation de Venezuela Telephone: +58-2-9432311 Fax: +58-2-9430323
Re: Finding files not present (challenge to your intelligence)
> > Hi, > > I was given a text file containing one file name (no full path name) > per line. My task consists of searching the entire filesystem and > generate a list of the files that are NOT present. > > At first I thought this was a task easyly solved with a couple of > awk's, sed's, and find's. However, it's been four days now and I still > haven't finished this stupid thing. Right now I am working with Perl > but haven't finished. I think I am close but just wanted to know > if someone here at debian-user has a simple solution, the shortest > one. > > The problem with using find is that this command does not return an > error code when it does not find a file. > > Thanks in advance. > > E.- > > -- > > Eloy A. Paris > Information Technology Department > Rockwell Automation de Venezuela > Telephone: +58-2-9432311 Fax: +58-2-9430323 How about using find and generate a list of ALL files, then "grep `indivual_lines_from_your_list` list_of_ALL_files" and checking grep's return value? Happy hacking, MartinS
Finding files not present (challenge to your intelligence)
Hi, I was given a text file containing one file name (no full path name) per line. My task consists of searching the entire filesystem and generate a list of the files that are NOT present. At first I thought this was a task easyly solved with a couple of awk's, sed's, and find's. However, it's been four days now and I still haven't finished this stupid thing. Right now I am working with Perl but haven't finished. I think I am close but just wanted to know if someone here at debian-user has a simple solution, the shortest one. The problem with using find is that this command does not return an error code when it does not find a file. Thanks in advance. E.- -- Eloy A. Paris Information Technology Department Rockwell Automation de Venezuela Telephone: +58-2-9432311 Fax: +58-2-9430323
Finding files not present (challenge to your intelligence)
Hi, I was given a text file containing one file name (no full path name) per line. My task consists of searching the entire filesystem and generate a list of the files that are NOT present. At first I thought this was a task easyly solved with a couple of awk's, sed's, and find's. However, it's been four days now and I still haven't finished this stupid thing. Right now I am working with Perl but haven't finished. I think I am close but just wanted to know if someone here at debian-user has a simple solution, the shortest one. The problem with using find is that this command does not return an error code when it does not find a file. Thanks in advance. E.- -- Eloy A. Paris Information Technology Department Rockwell Automation de Venezuela Telephone: +58-2-9432311 Fax: +58-2-9430323