Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[TOOL] sid-grep... un Grep per tutti i file in una cartella.
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Risorse italiane (documentazione e tools)
View previous topic :: View next topic  
Author Message
_sys/sid
Guru
Guru


Joined: 27 Aug 2004
Posts: 346
Location: Asola (Mantova)

PostPosted: Sun Oct 10, 2004 10:23 am    Post subject: [TOOL] sid-grep... un Grep per tutti i file in una cartella. Reply with quote

Code:

SidGrep 0.6.4
Release Date: 10 Oct 2004.

Ho fatto un piccolo script (che a me' risulta molto utile), non ho mai trovato niente di simile... quindi me lo sono fatto io... E' scritto in perl quindi e' consigliabile un emerge perl se non lo avete ancora installato...

Cosa Fa' ???
Lo Script cerca in Tutti i file (di testo) di una directory una certa stringa...
Stampando a video il nome del file dove e' contenuta quella stringa e la zona dove e' stata trovata la stringa. (Dare un occhiata agli esempi per capire meglio).
Lo Script e' abbastanza lungo quindi l'ho messo sul sito: http://gensid.altervista.org/bin/sid-grep

L'installazione
- da root digitate:
Code:
# cd /usr/bin/ && wget gensid.altervista.org/bin/sid-grep

adesso avete gia' installato lo script sid-grep... ho detto di metterlo in /usr/bin perche' e' una directory eseguibile... ma nulla vieta di metterlo in altra dir.
- Date un chmod 755 sid-grep
Code:
# chmod 755 sid-grep


Avviare lo Script
Code:
$ sid-grep


Per l'help basta avviarlo con l'opzione '--help'
Help
Code:

SidGrep 0.6.4

 Usage:
    sid-grep [ directory ] [ string ]
    sid-grep [ options ] [ directory ] [ string ]
    sid-grep [ --nocolor ] [ options ] [ directory ] [ string ]

 Examples:
    sid-grep /etc/apache2/conf "LoadModule python_module"
    sid-grep /usr/bin ^version --ncase
    sid-grep ./ mod_python.so -s
    sid-grep -nc /usr/bin who -n -s

 Options:
    -h    --help               Help. This Screen.
    -v    --version            SidGrep Version.
    -nc   --nocolor            Print With No Color.

    -c    --case               Case Sensitive Search.
    -n    --ncase              Non Case Sensitive Search.
    -s    --nospace            Delete Space on Output.

 * Report Bugs to <matteo_bertozzi@bsdmail.com>


Un Paio di Esempi
Code:

nemo@minasTirith [sid] $ sid-grep /etc/apache2/conf "LoadModule python_module"
apache2.conf: #LoadModule python_module                 pache2-extramodules/mod_python.so

Code:

nemo@minasTirith [sid] $ sid-grep /usr/bin ^version --ncase
abxtest: version="0.15.2 (beta)"
autoconf-2.59: version="\
autopoint: version=0.12.1
cups-config: VERSION="1.1.20"
cvsbug: VERSION=3.2
flashplayer-installer: VERSION="6"
fvwm-bug: VERSION="2.5.10"
fvwm-config: VERSION="2.5.10"
fvwm-config: VERSIONINFO=""
fvwm-menu-headlines: versions.
fvwm-menu-xlock: versions.
...


Spero vi sia d'aiuto come lo e' stato a me...
Per Bug o Miglioramenti (postare qui) o alla mia mail. matteo_bertozzi@bsdmail.com

Grazie Per L'attenzione. :wink:
_________________
http://th30z.netsons.org/
Back to top
View user's profile Send private message
n3m0
l33t
l33t


Joined: 08 Feb 2004
Posts: 798
Location: Richville, Naples, Italy, Europe

PostPosted: Sun Oct 10, 2004 12:30 pm    Post subject: Reply with quote

Scusami, forse ho letto superficialmente, ma non è quello che fa

Code:
# cd <directory>
# grep -nH <pattern> <filename>


es:

caso Case Sensitive

Code:

# cd /etc/apache2/conf
# grep -nH "LoadModule python_module" *.conf


caso Case Insensitive

Code:

# cd /etc/apache2/conf
# grep -inH "LoadModule python_module" *.conf



caso Case Sensitive ricorsivo

Code:

#
# grep -nHR "LoadModule python_module" /etc/apache2/conf


:?:
_________________
L’energia è la civiltà. Lasciarla in mano ai piromani/petrolieri è criminale. Perché aspettare che finisca il petrolio?
L’età della pietra non è mica finita per mancanza di pietre. - B.G.


Site/Blog: http://www.neminis.org
Back to top
View user's profile Send private message
_sys/sid
Guru
Guru


Joined: 27 Aug 2004
Posts: 346
Location: Asola (Mantova)

PostPosted: Sun Oct 10, 2004 3:34 pm    Post subject: Reply with quote

lo avevo detto... non avevo mai visto quelle opzioni di grep...
cmq fa' + o - la stessa cosa. :cry:
_________________
http://th30z.netsons.org/
Back to top
View user's profile Send private message
n3m0
l33t
l33t


Joined: 08 Feb 2004
Posts: 798
Location: Richville, Naples, Italy, Europe

PostPosted: Sun Oct 10, 2004 7:45 pm    Post subject: Reply with quote

_sys/sid wrote:
lo avevo detto... non avevo mai visto quelle opzioni di grep...
cmq fa' + o - la stessa cosa. :cry:


Mi spiace, non volevo "smontarti" :)
_________________
L’energia è la civiltà. Lasciarla in mano ai piromani/petrolieri è criminale. Perché aspettare che finisca il petrolio?
L’età della pietra non è mica finita per mancanza di pietre. - B.G.


Site/Blog: http://www.neminis.org
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Risorse italiane (documentazione e tools) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum