mirror of
https://codeberg.org/scip/dbtool.git
synced 2025-12-17 11:20:58 +01:00
migrated to github
This commit is contained in:
19
samples/locate/README
Normal file
19
samples/locate/README
Normal file
@@ -0,0 +1,19 @@
|
||||
just an example showing what's possible
|
||||
with dbtool. These two shell scripts
|
||||
are doing the same job as GNU locate.
|
||||
|
||||
updatedb
|
||||
creates a database which contains
|
||||
every file (with path) of a system
|
||||
along with all it's attributes.
|
||||
|
||||
locate
|
||||
searches in this database using
|
||||
user supplied regular expressions
|
||||
|
||||
You need to edit both scripts to suit
|
||||
your system.
|
||||
|
||||
|
||||
|
||||
T.v. Dein <tlinden@cpan.org>
|
||||
24
samples/locate/locate
Executable file
24
samples/locate/locate
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# simple locate alike
|
||||
# written as an example how to
|
||||
# use dbtool.
|
||||
#
|
||||
# locate searches the database
|
||||
# for a file which matches a
|
||||
# certain string. The parameter
|
||||
# to locate can be a fully perl-
|
||||
# compliant regular expression.
|
||||
#
|
||||
|
||||
dbtool="/usr/bin/dbtool";
|
||||
find="/usr/bin/find";
|
||||
db="/var/local/locate.db";
|
||||
sort="/bin/sort";
|
||||
regex=$1;
|
||||
|
||||
if [ "x$regex" != "x" ]; then
|
||||
$dbtool -d $db -S -k $regex -w -R;
|
||||
else
|
||||
echo "Usage: locate <expression>";
|
||||
fi
|
||||
25
samples/locate/locate~
Executable file
25
samples/locate/locate~
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# simple locate alike
|
||||
# written as an example how to
|
||||
# use dbtool.
|
||||
#
|
||||
# locate searches the database
|
||||
# for a file which matches a
|
||||
# certain string. The parameter
|
||||
# to locate can be a fully perl-
|
||||
# compliant regular expression.
|
||||
#
|
||||
# $Id: locate,v 1.3 2001/06/26 23:00:02 scip Exp $
|
||||
|
||||
dbtool="/usr/bin/dbtool";
|
||||
find="/usr/bin/find";
|
||||
db="/var/local/locate.db";
|
||||
sort="/bin/sort";
|
||||
regex=$1;
|
||||
|
||||
if [ "x$regex" != "x" ]; then
|
||||
$dbtool -d $db -S -k $regex -w -R;
|
||||
else
|
||||
echo "Usage: locate <expression>";
|
||||
fi
|
||||
19
samples/locate/updatedb
Executable file
19
samples/locate/updatedb
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# simple locate alike
|
||||
# written as an example how to
|
||||
# use dbtool.
|
||||
#
|
||||
# updatedb creates the database
|
||||
# which is then used by locate
|
||||
# to search for a certain string.
|
||||
#
|
||||
|
||||
dbtool="/usr/bin/dbtool";
|
||||
find="/usr/bin/find";
|
||||
db="/var/local/locate.db";
|
||||
egrep="/bin/egrep";
|
||||
cp="/bin/cp"
|
||||
|
||||
$cp /dev/null $db;
|
||||
$find / -ls | $egrep -v "^\/proc|dev|tmp" | $dbtool -d $db -i -f -R -t "^(.+?) (\/.*)$";
|
||||
21
samples/locate/updatedb~
Executable file
21
samples/locate/updatedb~
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# simple locate alike
|
||||
# written as an example how to
|
||||
# use dbtool.
|
||||
#
|
||||
# updatedb creates the database
|
||||
# which is then used by locate
|
||||
# to search for a certain string.
|
||||
#
|
||||
# $Id: updatedb,v 1.2 2001/06/26 23:00:02 scip Exp $
|
||||
#
|
||||
|
||||
dbtool="/usr/bin/dbtool";
|
||||
find="/usr/bin/find";
|
||||
db="/var/local/locate.db";
|
||||
egrep="/bin/egrep";
|
||||
cp="/bin/cp"
|
||||
|
||||
$cp /dev/null $db;
|
||||
$find / -ls | $egrep -v "^\/proc|dev|tmp" | $dbtool -d $db -i -f -R -t "^(.+?) (\/.*)$";
|
||||
Reference in New Issue
Block a user