[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [linux] petit truc en shell
Benjamin Michotte wrote:
> salut,
>
> imaginons que j'ai un fichier qui a ce genre de tronche: ($tmpfile)
> 3 open /dev/tty #success
> 3 open /dev/null #success
> 3 open /dev/null #success
> 3 open /dev/tty #success
> 4 open /tmp/malib/lib/#inst.19592# #success
> 0 chmod /tmp/malib/lib/#inst.19592# 0100755 #success
> 0 chmod /tmp/malib/lib/#inst.19592# 00644 #success
> 0 unlink /tmp/malib/lib/libpcre.so.0.0.1 #success
> 0 rename /tmp/malib/lib/#inst.19592# /tmp/malib/lib/libpcre.so.0.0.1 #success
> 0 unlink /tmp/malib/lib/libpcre.so.0.0.1 #success
> 0 symlink /tmp/malib/lib/libpcre.so.0.0.1 /tmp/malib/lib/libpcre.so.0 #success
> 0 unlink /tmp/malib/lib/libpcre.so.0.0.1 #success
> 0 symlink /tmp/malib/lib/libpcre.so.0.0.1 /tmp/malib/lib/libpcre.so #success
> 3 open /dev/tty #success
> 4 open /tmp/malib/lib/#inst.19611# #success
> 0 chmod /tmp/malib/lib/#inst.19611# 0100644 #success
> 0 unlink /tmp/malib/lib/libpcre.la #success
> 0 rename /tmp/malib/lib/#inst.19611# /tmp/malib/lib/libpcre.la #success
> 3 open /dev/tty #success
> 4 open /tmp/malib/lib/#inst.19624# #success
>
> je veux arriver à un fichier comme celui-ci: ($cpfile)
> dev/null
> dev/tty
> tmp/malib/bin/pcre-config
> tmp/malib/bin/pcregrep
> tmp/malib/include/pcre.h
> tmp/malib/include/pcreposix.h
> tmp/malib/lib/libpcre.a
> tmp/malib/lib/libpcre.la
> tmp/malib/lib/libpcre.so.0.0.1
> tmp/malib/lib/libpcreposix.a
> tmp/malib/lib/libpcreposix.la
> tmp/malib/lib/libpcreposix.so.0.0.0
> tmp/malib/man/man1/pcregrep.1
> tmp/malib/man/man3/pcre.3
> tmp/malib/man/man3/pcreposix.3
> tmp/pcre-3.4/pcregrep
> tmp/pcre-3.4/pcretest
>
> je fais donc un petit
> cat $tmpfile | cut -f3 | sort -u | while read line; do
> if [ -e "$line" ]; then
> echo $line | cut -d/ -f2- >> $cpfile
> fi
> done
>
> maintenant, je ne veux pas ni des lignes contenant dev, ni des lignes
> contenant la cwd (dans ce cas-ci: tmp/pcre-3.4 )
> Et là, je vois pas comment je peux faire ...
> un sed ? un grep ?
>
... | grep -v cwd | grep -v dev
tu n'auras pas les lignes contenant donc cwd et dev
--
Lionel Gavage Opérations: Réseaux
Email: lgavage@ulg.ac.be Tél: 04-3664845
Bat. B26 SEGI
[ Soyez précis dans vos sujets svp afin de déterminer directement ]
[ le type de demande... ]
[ Pour vous (dés)inscrire, aller sur http://linuxbe.org/ml.php ]
[ http://LinuxBe.org Contact: listmaster@linuxbe.org ]