[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [linux-team] conversion en vrac



Eric Darchis wrote:
> 
> Salut.
> 
> Je fais parfois une serie de capture avec kwintv. J'ai alors qq dizaines de
> fichiers PNM a convertir en JPG pour exploitation. Pour l'instant, je fais:
> for i in ` ls *.pnm|cut -d. -f1`; do convert $i.pnm jpg:$i.jpg && rm $i.pnm
> ; done
> 
> Mis a part le cut qui ne tient pas compte de plusieurs points eventuels
> (impossible ici) et qui pourrait etre remplace par un sed, voyez-vous une
> autre facon de faire ?

et basename ?

# basename gaga.pnm .pnm
gaga

# for i in *.pnm; do j=`basename $i .pnm` convert $i jpg:$j.jpg && rm $i
; done



> 
> Le probleme principal ici est que "for i in *.pnm" va mettre dans $i
> l'extension pnm et donc changer le nom en .jpg est plus difficile (appeler
> cut a chaque ligne me parait assez mauvais par rapport la solution plus haut).
> 
> Des idees ?
> 
> Eric.
> 
> PS: Quand j'ecris une commande pareille, je me dis "put@in, comment
> j'aurais fait sous Windows ?". Idem avec une substitution vi de 3 lignes...
> 
> --------
> Visit the Linux Supertore Online: http://www.redcorp.com !
> If you want to be deleted from the list, send a mail to
> majordomo@rtfm.be with "unsubscribe linux-team" in the body.
> Archive of the list: http://tania.be.linux.org/

-- 

Linux : May the sources be with you !
KeyLinux
Alain Spineux
 Linux System Engineer
--------
Visit the Linux Supertore Online: http://www.redcorp.com !
If you want to be deleted from the list, send a mail to
majordomo@rtfm.be with "unsubscribe linux-team" in the body.
Archive of the list: http://tania.be.linux.org/