Substitutions inter ligne
Résolu/Fermé
A voir également:
- Substitutions inter ligne
- Aller à la ligne excel - Guide
- Hors ligne instagram - Guide
- Vente en ligne particulier - Guide
- Partage de photos en ligne - Guide
- Apparaitre hors ligne whatsapp - 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
2 déc. 2008 à 20:05
2 déc. 2008 à 20:05
Salut,
[tmpfs]$ cat toto #define toto5 1024 extern UINT32 tab[]; #define toto4 512 extern UINT32 tab[]; #define toto6 2048 extern UINT32 tab[]; [tmpfs]$ sed '/^#define/{ h s/[^0-9]*\([0-9]*\)/\1/ N s/\([^ ]*\) \([^\n]*\)\(.*\)\(\[\)\(\]\).*/\3\1\4\2\5;/ H g s/\n// }' toto #define toto5 1024 extern UINT32 tab5[1024]; #define toto4 512 extern UINT32 tab4[512]; #define toto6 2048 extern UINT32 tab6[2048]; [tmpfs]$;-))
lami20j
Messages postés
21331
Date d'inscription
jeudi 4 novembre 2004
Statut
Modérateur, Contributeur sécurité
Dernière intervention
30 octobre 2019
3 567
2 déc. 2008 à 20:22
2 déc. 2008 à 20:22
Salut,
$ cat define #define toto5 1024 extern UINT32 tab[]; #define toto4 512 static UINT32 tab[]; #define toto6 2048 extern UINT32 tab[]; $ perl -ne '($x,$y)=/(\d+)\s(\d+)/ if/#def/;s/\[]/${x}[$y]/;print' define #define toto5 1024 extern UINT32 tab5[1024]; #define toto4 512 static UINT32 tab4[512]; #define toto6 2048 extern UINT32 tab6[2048];
lami20j
Messages postés
21331
Date d'inscription
jeudi 4 novembre 2004
Statut
Modérateur, Contributeur sécurité
Dernière intervention
30 octobre 2019
3 567
2 déc. 2008 à 22:27
2 déc. 2008 à 22:27
Re,
Ou
Ou
$ cat define #define toto5 1024 extern UINT32 tab[]; #define toto4 512 static UINT32 tab[]; #define toto6 2048 extern UINT32 tab[]; $ perl -ne '/#def/?($x,$y)=/(\d+)\s(\d+)/:s/\[/${x}[$y/;print' define #define toto5 1024 extern UINT32 tab5[1024]; #define toto4 512 static UINT32 tab4[512]; #define toto6 2048 extern UINT32 tab6[2048];