ciao a tutti, avrei bisogno di creare uno script che possa "affettare" un file in tanti piccoli files. il file in questione (Packages.gz) è riportato sotto. bisognerebbe poter fare un cat dalla parola "Package:" fino alla seguente esclusa, e salvare il testo in un file con il nome del package stesso: ovvero ottenere per per esempio un file dal nome "affix" contenete la sua descrizione, e poi un altro file dal nome "apt-cacher" contenente la sua descrizione e così via. ( il messaggio `e codificato in UTF8) per pemettere la visualizzazione di caratteri hogt-ascii) pensavo di fare qualche cosa del genere: ------------------- cat Packages | tr '\n' 'Ñ' | sed s/ÑÑ/Ñ∑/g | tr '∑' '\n' > filegrosso-preprocessato for i in `cat filegrosso-preprocessato`; do PackName=`echo $i | tr 'Ñ' '\n' | grep 'Package:' | sed s/Package:\ //g` echo $i | tr '\n' 'Ñ' > $PackName done ------------------- che tradotto significa: cat del Packages, converto tutti gli acapo in Ñ, quando trovo due ÑÑ attaccate le converto in Ñ∑, riconverto tutte le ∑ in accapo e salvo inun file temporaneo filegrosso-preprocessato. per ogni linea in filegrosso-preprocessato estraggo il nome del Pacchetto (PackName). converto le Ñ di ogni riga in accapo e la salvo in un file con il nome del pacchetto ...funzionare funziona. ...ma pensavo che forse c'è quelche cosa di più sofisticato senza files temporanei. idee? ciao MaX qui un esempio del packages.gz in questione Package: affix Priority: extra Section: net Installed-Size: 320 Maintainer: Mario Joussen <joussen@debian.org> Architecture: powerpc Version: 2.1.1-3 Depends: libaffix2 (>= 2.1.1), libc6 (>= 2.3.2.ds1-21), libopenobex-1.0-0 (>= 1.0.0-rel), python, python-gtk2 Suggests: affix-source Filename: pool/updates/main/a/affix/affix_2.1.1-3_powerpc.deb Size: 94880 MD5sum: 8af910d14455e555e6cb5840830c5724 Description: User space utilities for the Affix Bluetooth protocol stack The Affix Bluetooth protocol stack for Linux supports core protocols like L2CAP, RFCOMM, SDP and different profiles like serial port profile. . This package contains several user space utilities for Affix. Package: apt-cacher Priority: optional Section: net Installed-Size: 204 Maintainer: Eduard Bloch <blade@debian.org> Architecture: all Version: 0.9.4sarge1 Depends: perl (>= 5.6.0-16), curl, apache | apache-ssl | apache2 | boa | httpd-cgi Filename: pool/updates/main/a/apt-cacher/apt-cacher_0.9.4sarge1_all.deb Size: 39092 MD5sum: 33c67a2990c5e9c8c52bd20b8ce72816 Description: caching system for Debian package and source files Apt-cacher performs caching of .deb and source packages which have been downloaded by local users. When a package is requested, the cache checks whether it already has the latest version, in which case it sends the package to the user immediately. If not, it downloads the package while streaming it to the user at the same time. A local copy is then kept for use by other users. Package: backup-manager Priority: optional Section: admin Installed-Size: 232 Maintainer: Alexis Sukrieh <sukria@sukria.net> Architecture: all Version: 0.5.7-1sarge1 Depends: debconf, gzip (>= 1.3) Suggests: zip, libnet-perl, perl, perl-modules, ssh, cdrecord, mkisofs, gettext-base, anacron Filename: pool/updates/main/b/backup-manager/backup-manager_0.5.7-1sarge1_all.deb Size: 30550 MD5sum: 3bbe99ebf51f69ca80a93e19a64880ac Description: command-line backup tool for GNU Linux This is a backup program, designed to help you make daily archives of your file system. . Written in bash and perl, it can make tar, tar.gz, tar.bz, and zip archives and can be run in a parallel mode with different configuration files. . Archives are kept for a given number of days and the upload system can use ftp or scp to transfer the generated archives to a list of remote hosts. . The configuration file is very simple and basic and gettext is used for internationalization. Package: bluez-cups |