Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

LinuxÏÂgrepʹÓÃÏêϸ½éÉÜ


1. grep¼ò½é
grep £¨global search regular expression(RE) and print out the line,È«ÃæËÑË÷ÕýÔò±í´ïʽ²¢°ÑÐдòÓ¡³öÀ´£©ÊÇÒ»ÖÖÇ¿´óµÄÎı¾ËÑË÷¹¤¾ß£¬ËüÄÜʹÓÃÕýÔò±í´ïʽËÑË÷Îı¾£¬²¢°ÑÆ¥ÅäµÄÐдòÓ¡³öÀ´¡£UnixµÄgrep¼Ò×å°ü À¨grep¡¢egrepºÍfgrep¡£egrepºÍfgrepµÄÃüÁîÖ»¸úgrepÓкÜС²»Í¬¡£egrepÊÇgrepµÄÀ©Õ¹£¬Ö§³Ö¸ü¶àµÄreÔª×Ö·û£¬ fgrep¾ÍÊÇfixed grep»òfast grep£¬ËüÃÇ°ÑËùÓеÄ×Öĸ¶¼¿´×÷µ¥´Ê£¬Ò²¾ÍÊÇ˵£¬ÕýÔò±í´ïʽÖеÄÔª×Ö·û±íʾ»ØÆä×ÔÉíµÄ×ÖÃæÒâÒ壬²»ÔÙÌØÊâ¡£linuxʹÓÃGNU°æ±¾µÄgrep¡£Ëü¹¦ÄÜ ¸üÇ¿£¬¿ÉÒÔͨ¹ý-G¡¢-E¡¢-FÃüÁîÐÐÑ¡ÏîÀ´Ê¹ÓÃegrepºÍfgrepµÄ¹¦ÄÜ¡£
grepµÄ¹¤×÷·½Ê½ÊÇÕâÑùµÄ£¬ËüÔÚÒ»¸ö»ò¶à¸öÎļþÖÐËÑË÷×Ö·û´®Ä£°å¡£Èç¹ûÄ£°å°üÀ¨¿Õ¸ñ£¬Ôò±ØÐë±»ÒýÓã¬Ä£°åºóµÄËùÓÐ×Ö·û´®±»¿´×÷ÎļþÃû¡£ËÑË÷µÄ½á¹û±»Ë͵½ÆÁÄ»£¬²»Ó°ÏìÔ­ÎļþÄÚÈÝ¡£
grep¿ÉÓÃÓÚshell½Å±¾£¬ÒòΪgrepͨ¹ý·µ»ØÒ»¸ö״ֵ̬À´ËµÃ÷ËÑË÷µÄ״̬£¬Èç¹ûÄ£°åËÑË÷³É¹¦£¬Ôò·µ»Ø0£¬Èç¹ûËÑË÷²»³É¹¦£¬Ôò·µ»Ø1£¬Èç¹ûËÑË÷µÄÎļþ²»´æÔÚ£¬Ôò·µ»Ø2¡£ÎÒÃÇÀûÓÃÕâЩ·µ»ØÖµ¾Í¿É½øÐÐһЩ×Ô¶¯»¯µÄÎı¾´¦Àí¹¤×÷¡£
2. grepÕýÔò±í´ïʽԪ×Ö·û¼¯£¨»ù±¾¼¯£©
^
궨ÐеĿªÊ¼ È磺'^grep'Æ¥ÅäËùÓÐÒÔgrep¿ªÍ·µÄÐС£
$
궨ÐеĽáÊø È磺'grep$'Æ¥ÅäËùÓÐÒÔgrep½áβµÄÐС£
.
Æ¥ÅäÒ»¸ö·Ç»»ÐзûµÄ×Ö·û È磺'gr.p'Æ¥Åägrºó½ÓÒ»¸öÈÎÒâ×Ö·û£¬È»ºóÊÇp¡£
*
Æ¥ÅäÁã¸ö»ò¶à¸öÏÈÇ°×Ö·û È磺'*grep'Æ¥ÅäËùÓÐÒ»¸ö»ò¶à¸ö¿Õ¸ñºó½ô¸úgrepµÄÐС£ .*Ò»ÆðÓôú±íÈÎÒâ×Ö·û¡£
[]
Æ¥ÅäÒ»¸öÖ¸¶¨·¶Î§ÄÚµÄ×Ö·û£¬Èç'[Gg]rep'Æ¥ÅäGrepºÍgrep¡£
[^]
Æ¥ÅäÒ»¸ö²»ÔÚÖ¸¶¨·¶Î§ÄÚµÄ×Ö·û£¬È磺'[^A-FH-Z]rep'Æ¥Åä²»°üº¬A-RºÍT-ZµÄÒ»¸ö×Öĸ¿ªÍ·£¬½ô¸úrepµÄÐС£
\(..\)
±ê¼ÇÆ¥Åä×Ö·û£¬Èç'\(love\)'£¬love±»±ê¼ÇΪ1¡£
\<
궨µ¥´ÊµÄ¿ªÊ¼£¬Èç:'\<grep'Æ¥Åä°üº¬ÒÔgrep¿ªÍ·µÄµ¥´ÊµÄÐС£
\>
궨µ¥´ÊµÄ½áÊø£¬Èç'grep\>'Æ¥Åä°üº¬ÒÔgrep½áβµÄµ¥´ÊµÄÐС£
x\{m\}
Öظ´×Ö·ûx£¬m´Î£¬È磺'0\{5\}'Æ¥Åä°üº¬5¸öoµÄÐС£
x\{m,\}
Öظ´×Ö·ûx,ÖÁÉÙm´Î£¬È磺'o\{5,\}'Æ¥ÅäÖÁÉÙÓÐ5¸öoµÄÐС£
x\{m,n\}
Öظ´×Ö·ûx£¬ÖÁÉÙm´Î£¬²»¶àÓÚn´Î£¬È磺'o\{5,10\}'Æ¥Åä5--10¸öoµÄÐС£
\w
Æ¥ÅäÎÄ×ÖºÍÊý×Ö×Ö·û£¬Ò²¾ÍÊÇ[A-Za-z0-9]£¬È磺'G\w*p'Æ¥ÅäÒÔGºó¸úÁã¸ö»ò¶à¸öÎÄ×Ö»òÊý×Ö×Ö·û£¬È»ºóÊÇp¡£
\W
\wµÄ·´ÖÃÐÎʽ£¬Æ¥ÅäÒ»¸ö»ò¶à¸ö·Çµ¥´Ê×Ö·û£¬ÈçµãºÅ¾äºÅµÈ¡£
\b
µ¥´ÊËø¶¨·û£¬Èç: '\bgrep\b'ֻƥÅägrep¡£
3. ÓÃÓÚegrepºÍ grep -EµÄÔ


Ïà¹ØÎĵµ£º

Linux´ÅÅÌ·ÖÇøUUIDµÄ»ñÈ¡¼°ÆäUUIDµÄ×÷ÓÃ

Ò»¡¢Linux´ÅÅÌ·ÖÇøUUIDµÄ»ñÈ¡·½·¨
1¡¢[san@localhost ~]$ ls -l /dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root 10 2010-01-18 02:18 0733f5c1-cb85-4f98-9d4f-122cfcee9806
-> ../../sdc1
lrwxrwxrwx 1 root root 10 2010-01-18 01:13 3754-1BDB
-> ../../sda5
lrwxrwxrwx 1 root root 10 2010-01-18 ......

REdHat Linux 5 JDKµÄ°²×°¼°»·¾³µÄÅäÖÃ

1.ÔÚsunµÄ¹Ù·½ÏÂÔØjdk-6u15-linux-i586.bin
2. chmod 755 jdk-6u15-linux-i586.bin
3. ./jdk-6u15-linux-i586.bin
4.´Ëʱ»á³öÏÖJDK
°²×°ÊÚȨЭÒé¡£¿ÉÒÔһ·°´Enter
ä¯ÀÀ¡£Èç¹ûµÈµÄ²»ÄÍ·³¿ÉÒÔÖ±½Ó°´Ctrl+C,
Ö±½Ó»á³öÏÖDo you agree to the above license terms? [yes or no]
µÄ×ÖÑù¡£ÊäÈëyes¼´¿É
5.ÉèÖû·¾³±äÁ¿:
a ......

LinuxÏÂÍøÂç±à³Ì¸ÅÊö


LinuxÏÂÍøÂç±à³Ì¸ÅÊö
Ò»£®ÍøÂç֪ʶ¸ÅÊö
ÍøÂç³ÌÐòºÍÆÕͨ³ÌÐò×î´óµÄÇø±ðÊÇÍøÂç³ÌÐòÓÉÁ½²¿·Ö×é³É£º¿Í»§¶ËºÍ·þÎñÆ÷¶Ë¡£
¿Í»§¶Ë£ºÔÚÍøÂç³ÌÐòÖУ¬Èç¹ûÒ»¸ö³ÌÐòÖ÷¶¯ºÍÍâÃæµÄ³ÌÐòͨÐÅ£¬ÄÇôÎÒÃǾͰѸóÌÐò³ÆΪ¿Í»§¶Ë³ÌÐò¡£
·þÎñÆ÷¶Ë£ººÍ¿Í»§¶Ë¶ÔÓ¦µÄ³ÌÐò¼´Îª·þÎñÆ÷¶Ë£»±»¶¯µØµÈ´ýÍâÃæ³ÌÐòÀ´ºÍ×Ô¼ºÍ¨ÐŵijÌÐò¼´Îª·þÎñÆ÷¶Ë³ÌÐò¡ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ