Sequence par deux du fichier
Résolu/Fermé
mlkndiaye
-
28 mai 2010 à 20:20
jipicy Messages postés 40842 Date d'inscription jeudi 28 août 2003 Statut Modérateur Dernière intervention 10 août 2020 - 29 mai 2010 à 17:06
jipicy Messages postés 40842 Date d'inscription jeudi 28 août 2003 Statut Modérateur Dernière intervention 10 août 2020 - 29 mai 2010 à 17:06
A voir également:
- Sequence par deux du fichier
- Fichier rar - Guide
- Fichier host - Guide
- Fichier iso - Guide
- Comment réduire la taille d'un fichier - Guide
- Ouvrir fichier .bin - Guide
4 réponses
jipicy
Messages postés
40842
Date d'inscription
jeudi 28 août 2003
Statut
Modérateur
Dernière intervention
10 août 2020
4 895
29 mai 2010 à 09:59
29 mai 2010 à 09:59
Bonjour,
S'il vous plaît, merci, c'est trop demander ???
Je veux => Je voudrai, j'aimerai, etc.
A lire...
Merci.
S'il vous plaît, merci, c'est trop demander ???
Je veux => Je voudrai, j'aimerai, etc.
A lire...
Merci.
Bonjour,
Avec awk:
Avec awk:
awk '{i=i+(NR%2?1:0);print substr($0,1,24) i substr($0,25)}' fichier
Bonjour,
Ca marche mais il y a un decadrage a partir de la 18em ligne,
je rappele que les 24 premieres caracteres sont reservées pour la sequence.
voir ci-dessous
000000000000000000000008CA50000000000000000000 2010000016DDA 01
000000000000000000000009CH5001000000000000000000 2010000016 0
000000000000000000000009CA50000000000000000000 2010000016DDA 01
0000000000000000000000010CH5009000000000000000000 2010000016
0000000000000000000000010CA50000000000000000000 2010000016DDA 0
0000000000000000000000011CH5010000000000000000000 2010000016
0000000000000000000000011CA50000000000000000000 2010000016DDA 0
0000000000000000000000012CH5007000000000000000000 2010000016
0000000000000000000000012CA50000000000000000000 2010000016DDA 0
0000000000000000000000013CH5008000000000000000000 2010000016
0000000000000000000000013CA50000000000000000000 2010000016DDA 1
0000000000000000000000014CH5001000000000000000000 2010000016
0000000000000000000000014CA50000000000000000000 2010000016DDA 0
Ca marche mais il y a un decadrage a partir de la 18em ligne,
je rappele que les 24 premieres caracteres sont reservées pour la sequence.
voir ci-dessous
000000000000000000000008CA50000000000000000000 2010000016DDA 01
000000000000000000000009CH5001000000000000000000 2010000016 0
000000000000000000000009CA50000000000000000000 2010000016DDA 01
0000000000000000000000010CH5009000000000000000000 2010000016
0000000000000000000000010CA50000000000000000000 2010000016DDA 0
0000000000000000000000011CH5010000000000000000000 2010000016
0000000000000000000000011CA50000000000000000000 2010000016DDA 0
0000000000000000000000012CH5007000000000000000000 2010000016
0000000000000000000000012CA50000000000000000000 2010000016DDA 0
0000000000000000000000013CH5008000000000000000000 2010000016
0000000000000000000000013CA50000000000000000000 2010000016DDA 1
0000000000000000000000014CH5001000000000000000000 2010000016
0000000000000000000000014CA50000000000000000000 2010000016DDA 0
dubcek
Messages postés
18718
Date d'inscription
lundi 15 janvier 2007
Statut
Contributeur
Dernière intervention
22 mars 2024
5 615
29 mai 2010 à 15:59
29 mai 2010 à 15:59
hello
%02d pour moins de 198 lignes, pour plus mettre %03d ou plus
%02d pour moins de 198 lignes, pour plus mettre %03d ou plus
gawk 'BEGIN{FS=OFS=""};{$24=$24 sprintf("%02d", i+=and(NR,1)) ; print}' fichier
jipicy
Messages postés
40842
Date d'inscription
jeudi 28 août 2003
Statut
Modérateur
Dernière intervention
10 août 2020
4 895
29 mai 2010 à 16:26
29 mai 2010 à 16:26
Fais un effort en convertissant tes fichiers ! Voir liens !
jipicy
Messages postés
40842
Date d'inscription
jeudi 28 août 2003
Statut
Modérateur
Dernière intervention
10 août 2020
4 895
29 mai 2010 à 17:06
29 mai 2010 à 17:06
dubcek c'est notre maitre Yoda du awk ;-))
dubcek
Messages postés
18718
Date d'inscription
lundi 15 janvier 2007
Statut
Contributeur
Dernière intervention
22 mars 2024
5 615
Modifié par dubcek le 29/05/2010 à 16:38
Modifié par dubcek le 29/05/2010 à 16:38
essaye
GNU AWK. MKS Toolkit for System Administrators and all higher products feature the GNU AWK utility (gawk). GNU AWK is an alternate version of the awk pattern matching and scripting language used predominantly for searching through and manipulating text-based files and data. gawk has been included to provide compatibility with other GNU tools and ported scripts from a GNU environment.
sinon tu prends le code de ripat et tu changes i par sprintf("%02d", i)
GNU AWK. MKS Toolkit for System Administrators and all higher products feature the GNU AWK utility (gawk). GNU AWK is an alternate version of the awk pattern matching and scripting language used predominantly for searching through and manipulating text-based files and data. gawk has been included to provide compatibility with other GNU tools and ported scripts from a GNU environment.
sinon tu prends le code de ripat et tu changes i par sprintf("%02d", i)