Path: ...!newsreader4.netcologne.de!news.netcologne.de!news.imp.ch!news.alphanet.ch!alphanet.ch!.POSTED!not-for-mail From: Marc SCHAEFER Newsgroups: fr.comp.lang.perl Subject: Re: regrouper des fichiers plats puis =?ISO-8859-1?Q?=E9clater?= un fichier Date: Tue, 14 Jun 2022 10:17:50 -0000 (UTC) Organization: Posted through ALPHANET Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Injection-Date: Tue, 14 Jun 2022 10:17:50 -0000 (UTC) Injection-Info: shakotay.alphanet.ch; posting-account="schaefer"; logging-data="6903"; mail-complaints-to="usenet@alphanet.ch"; posting-host="634ce6c9682d817d72f6177875e2bb4f.nnrp.alphanet.ch" User-Agent: tin/2.4.3-20181224 ("Glen Mhor") (UNIX) (Linux/4.19.0-20-amd64 (x86_64)) Cancel-Lock: sha256:l99Da0tSepM8ZGGA4e/lvlA53y71aQaoVNAKbzhVuVw= sha256:N4bik0nb8pZ3G7F1AXpvqbZmfYHEbUSl9pGeUS0a7DA= Bytes: 1926 Lines: 23 jajah wrote: > contient (csv ou txt) et qui ont tous la même structure (11 champs séparés par > des points virgules) > 2- concaténer/regrouper ces fichiers en un seul et lui donner un nom de type > ABC-123 un simple cat du shell bash pourrait-il suffire? cat > ABC-123 $(find . -name '*.csv'; find . -name '*.txt) ou si par répertoire: for i in * do cat > $(basename $i)-ABC-123 $(find . -name '*.csv'; find . -name '*.txt) done Bash est désormais même disponible sous Microsoft (Git bash p.ex.). > II- Phase 2 : découper un fichier reçu > 1- découper un fichier (3 champs) en plusieurs fichiers selon un critère à > savoir le dernier champ (exp ABCDE1234) Là par contre, effectivement, Perl semble une bonne idée.