From d3602d5b2165edf66a0c4bdbf4652cb3cd3d5ac8 Mon Sep 17 00:00:00 2001 From: tTh Date: Sat, 3 Dec 2022 17:43:04 +0100 Subject: [PATCH] add exemple for dumpgdbm use --- DumpGDBM/README.md | 42 +++++++++++++++++++++++++++++++++++++++--- DumpGDBM/exemple.pl | 1 + 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/DumpGDBM/README.md b/DumpGDBM/README.md index 49cebe8..2e49cb1 100644 --- a/DumpGDBM/README.md +++ b/DumpGDBM/README.md @@ -9,8 +9,44 @@ https://en.wikipedia.org/wiki/DBM_(computing) ## Exemple Le mini-script Perl `exemple.pl` montre bien comment faire une "base de données -associative" en Perl. - - +associative" en Perl. Il extrait les champs _usernale_ et _GECOS_ du fichier +`/etc/passwd` et les injecte dans un fichier gdbm. + +``` +tth@redlady:~/Devel/KlugyTools/DumpGDBM$ ./exemple.pl +tth@redlady:~/Devel/KlugyTools/DumpGDBM$ ./dumpgdbm -i exemple.gdbm +working on [exemple.gdbm] + +dumpgdbm > first +K: rtkit. +D: RealtimeKit,,,. + +dumpgdbm > next +K: man. +D: man. + +dumpgdbm > next +K: lightdm. +D: Light Display Manager. + +dumpgdbm > ? ks + +command [ks] + Search a posix regex pattern in all the key fields. + +dumpgdbm > ks root +K: root. +D: root. + +dumpgdbm > ks tth +K: tth. +D: tTh,,,. + +dumpgdbm > +EOF ? +tth@redlady:~/Devel/KlugyTools/DumpGDBM$ +``` + +Well done bro. diff --git a/DumpGDBM/exemple.pl b/DumpGDBM/exemple.pl index 430d9ad..7e74a0f 100755 --- a/DumpGDBM/exemple.pl +++ b/DumpGDBM/exemple.pl @@ -15,6 +15,7 @@ while () @champs = split ":", $_; $user = $champs[0]."\0"; $gecos = $champs[4]."\0"; + # print $user, " ", $gecos, "\n"; $DB{$user} = $gecos; }