Shell grep matches Chinese
Test text demo_exe.c, content as follows, need to pay attention to the saved encoding format, the output to the terminal has an impact:
Our Chinese operating system Asni by default is GBK.
1#include <stdio.h>2#include <stdlib.h>3#include <string.h>4#include <errno.h>5#include <locale.h>6#include <dlfcn.h>7 8 /*9 * Export ld_library_path= $LD _library_path:/data/local/tmp;/data/local/tmp/demo_exeTen */ One intMainintargcChar**argv) { A //this is Chinese . - void*handle =NULL; - Char* Locname = setlocale (Lc_all,""); the //this is Chinese . - // - if((handle = Dlopen (Demo_dso_so, rtld_now)) = =NULL) { -printf"dlopen Error:%s\n", Dlerror ()); + } -printf"@%s[%s]dlopen return handle =% #x. \ n", __file__, __function__, handle); + //this is A //English at return 0; -}
1. Match specific text:
$ GREP-NP "\xe4\xb8\xad\xe6\x96\x87|\xd6\xd0\xce\xc4"./demo_exe.c
12://This is Chinese
15://This is Chinese
22://Chinese
Coding |
In |
Text |
Online Code table |
GBK |
D6d0 |
CEC4 |
Http://www.lhelper.org/tech/chinese_internal_code_specification_classified.txt |
Unicode |
4e2d |
6587 |
|
UTF-8 |
%e4%b8%ad |
%e6%96%87 |
Http://wenku.baidu.com/link?url=DfbzjKLcRaQ7yVIA_EHVP7mKdVbkggq4hwkCmmO9uR76Jib_5Y1Y_h616NnI21XY_x85YZqN1SQBAdCFQjklS_ |
GBK code: =d6d0, Wen =cec4
Unicode code: =4e2d, Wen =6587
UTF-8 code: =%e4%b8%ad, Wen =%e6%96%87
2. Match a specific range of text
$ GREP-NP "[\xb0\xa1-\xf7\xfe]+"/home/fangss/c/dynamic_share_object_test/demo_exe.c
12://This is Chinese
15://This is Chinese
18:printf ("Dlopen Error:%s\n", Dlerror ());
21://this is
22://Chinese
Range:
GBK/2: GB2312 Kanji B0 0 1 2 3 4 5 6 7 8 9 a B c d e FA ah Ae next to ah Alas AI cancer ai ai obstruction ai b saddle ammonia ann I press the dark bank amine case AO regretful ao ba grilled ba ba scar ba Pai d target Rake dam pa Baiber Bai Bai defeat worship Barnyard Patch E class move wrench board version dress mix flap half of the Bang Gang tie bar Bang Bang the league rod pound clam pound To slander the skin of a pack of cells
。。。
F7 0 1 2 3 4 5 6 7 8 9 a B c d e FA ao fin sole widowed ray shad bladder cod eel obtusiloba bighead siniperca chuatsi eel trout snakehead b tartar martingale Tartar Joe Harness Haiyun queue tanned 鞲鞴 骱 dice skull Uighur sacral epiphyseal c iliac condyle thigh crossbones iliac hip patella Repose 魃 dire Pixy 魈 Sean Aper treats D contentment voracious foodies shinny 髟 fine china huangshan quiff Beard darwinopterus bun moustache painted curls 鬏 sideburns make matters worse e Iguana nano Jimi suede Elaphurus jianyu coarsens Moose qi frustration Musk Lin Dai deposed tetrahedrite craftiness f yi Elegance 黩 Mucuna tattoo 黪 're ferret colugos echidna mousedeers rhinitis snoring 齄
Shell grep matches Kanji