View Single Post

   
  #6 (permalink)  
Old 05-07-2008, 10:16 AM
Steve Ackman
 
Posts: n/a
Default Re: How to find holes in a sequence?

In <41e20971-4fa0-41eb-9eff-b2bcddb1d6a5@d45g2000hsc.googlegroups.com>,
on Tue, 6 May 2008 00:08:15 -0700 (PDT), cvh@LE,
christian.hansel@cpi-service.com wrote:

> I am abit surprised that running a shell script over a directory
> should take so long.


It takes ~34 minutes on this machine just to do this:

#! /bin/sh

i=3
while [ $i -le 79389 ]
do
echo $i
mysql news <<MARKER
INSERT into count
(id)
VALUES
($i);
MARKER
i=$((i+1))
done

Now that it's made, I can look at your earlier post
re: left join deny to see if I can actually make any
sense of it. ;-)

> Using Linux tools like awk with piped output to mysql a table (given
> its created) of all filenames/nodes in a directory can easily be
> created by something like:
>
> ls -l |awk '$1!~/^d/{print "INSERT INTO mytable set filename=
> \""$8"\";"}' |mysql -uxxxx -pxxxx mydatabase


I'm breaking out headers (with awk/sed) so I can do:

mysql news <<MARKER
# DELETE FROM rcm WHERE server_id = $i;
INSERT into rcm
(server_id,Message_ID,Sender,Subject,Date,User_Age nt,NNTP_Posting_Host,X_Trace,Content_Type,Xref,Art icle)
VALUES
($i,"$Message_ID","$Sender",'$Subject','$Date','$U ser_Agent','$NNTP_Posting_Host','$X_Trace','$Conte nt_Type','$Xref',"$Article");
MARKER

> of course this would take longer if your putting fulltext content in
> the database, too.


I haven't decided about fulltext yet... or whether
to include Lines and Bytes.

>However this little snippet should suffice to fill
> a table of all files in a directory


I don't see that simply filling a table with files
would be particularly useful (would it?), though I
suppose searching keywords would be quicker than using
grep.

Reply With Quote