Remplacer un caractère à travers shell
chiefNam
Messages postés
7
Statut
Membre
-
zipe31 Messages postés 34620 Date d'inscription Statut Contributeur Dernière intervention -
zipe31 Messages postés 34620 Date d'inscription Statut Contributeur Dernière intervention -
2 réponses
-
Salut,
Il aurait été plus judicieux de nous faire un copier/coller d'un bout de ton fichier plutôt que de mettre des captures d'écran ;-(
Un truc du genre devrait le faire (sous réserve qu'il n'y ait pas de caractères sournois dans ton fichier) :
$ cat f1
qdqsdqsgd|klqsdq|qkhdqsklhdqskl \
|hsdjkfhsjfh|kfjdfjsdk|||
gjldmfjgldfm|glmdfgk|mjc \
|fjsdkl|klsdf|||
$ sed ':z;N;$!bz;s/\\\n/|/g' f1
qdqsdqsgd|klqsdq|qkhdqsklhdqskl ||hsdjkfhsjfh|kfjdfjsdk|||
gjldmfjgldfm|glmdfgk|mjc ||fjsdkl|klsdf|||
-
Salut @zipe31,
Ci-dessous le contenu
hhhth|yuiok,|fee|rtnjjk| |derf|xcvg| |ghjui|tgrfe|g|14/06/2018|huuj|uytr|5896,0|x|hikioujk \
|Z|gtyyhju| | | | | | |896|hjyj|yjyj|| |rtj|rzrtyh| |h|r|e| ||rey|hyh|grry|ryy|hji,0|htrh|th|0| | |thj| |thtj| ||| | | | |
jyjj|yj|rj|rtj| |rtj|rtj| |rtj|ffh|3|14/06/2018|9000|14/06/2018|33000,0|C|olppkh \
|Z|gtyyhju| | | | | | |896|hjyj|yjyj|| |rtj|rzrtyh| |h|r|e| ||rey|hyh|grry|ryy|hji,0|htrh|th|0| | |thj| |thtj| ||| | | | |
hhhth|yuiok,|fee|rtnjjk| |derf|xcvg| |ghjui|tgrfe|g|14/06/2018|huuj|uytr|5896,0|x|hikioujk \
|Z|gtyyhju| | | | | | |896|hjyj|yjyj|| |rtj|rzrtyh| |h|r|e| ||rey|hyh|grry|ryy|hji,0|htrh|th|0| | |thj| |thtj| ||| | | | |
jyjj|yj|rj|rtj| |rtj|rtj| |rtj|ffh|3|14/06/2018|9000|14/06/2018|33000,0|C|olppkh \
|Z|gtyyhju| | | | | | |896|hjyj|yjyj|| |rtj|rzrtyh| |h|r|e| ||rey|hyh|grry|ryy|hji,0|htrh|th|0| | |thj| |thtj| ||| | | | |
hhhth|yuiok,|fee|rtnjjk| |derf|xcvg| |ghjui|tgrfe|g|14/06/2018|huuj|uytr|5896,0|x|hikioujk \
|Z|gtyyhju| | | | | | |896|hjyj|yjyj|| |rtj|rzrtyh| |h|r|e| ||rey|hyh|grry|ryy|hji,0|htrh|th|0| | |thj| |thtj| ||| | | | |
jyjj|yj|rj|rtj| |rtj|rtj| |rtj|ffh|3|14/06/2018|9000|14/06/2018|33000,0|C|olppkh \
|Z|gtyyhju| | | | | | |896|hjyj|yjyj|| |rtj|rzrtyh| |h|r|e| ||rey|hyh|grry|ryy|hji,0|htrh|th|0| | |thj| |thtj| ||| | | | |
je souhaite avoir au rendu ceci:
-
-
-
-
-
-
Bonjour,
Je suis assez mauvais avec awk mais un truc du genre :
awk 'BEGIN {ORS=" "} {print} END {print "\n"}' SOURCE
SOURCE étant la chaîne à modifier