2008/11/7 Nguyen Vu Hung <vuhung16plus at gmail.com>: > 2008/11/7 L? Xu?n Th?o <thaolx at gmail.com>: >> 2008/11/7 Nguyen Vu Hung <vuhung16plus at gmail.com>: >>> 2008/11/7 L? Xu?n Th?o <thaolx at gmail.com>: >>>>>> ?c, t?i th?y trong s? ?? ch? kho?ng 5 lo?i %xx ch? l?m g? ??n 256. >>>>> >>>>> Bug prone. Trong ?? ch? c? 5 lo?i v? em ch? li?t k? kho?ng 20 files. >>>>> Trong tr??ng h?p t?ng qu?t ph?i duy?t c? ASCII table. >>>> >>>> Ng? d?y quay ra chi?n ti?p b?ng sed v? bash hehe: >>>> >>>> $ for N in `find . -iname '*%*'` >>>> do mv "$N" "`echo $N | sed -f sed.script`" >>>> done >>>> >>>> l?n n?y t?ng h?t ph?n sed script v?o trong file sed.script. Structure >>>> v?n nh? c?. Ch? convert b?ng ascii 7 bit n?n c? t?t c? 95 k? t? (kh?ng >>>> ngh? l? ascii extended l? h?p l?). Ngo?i ra ph?n hex code %xx n?u c? >>>> ch? c?i th? ph?i l? ch? hoa. >>> >>> cat sed.script ? >> >> attach r?i m?! >> >> n?u b?c mu?n support c? hex code ch? th??ng ki?u %5b th?... coi nh? >> ??y l? b?i luy?n t?p v?y :) > > Code c?a b?c 257 d?ng k? c? command :).
nope, file sed.script t?i gen b?ng 13 d?ng c. $ wc sedgen.c 13 23 176 sedgen.c $ cat sedgen.c #include <stdio.h> #include <stdlib.h> int main() { int i; printf("# a sed script, automatically generated\n"); for (i=0x20; i<=0x7f; i++) printf("s/%%%X/%c/g\n", i, i); return EXIT_SUCCESS; }