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

[ת]linux tr

ͨ¹ýʹÓà tr£¬Äú¿ÉÒԷdz£ÈÝÒ×µØʵÏÖ sed µÄÐí¶à×î»ù±¾¹¦ÄÜ¡£Äú¿ÉÒÔ½« tr ¿´×÷Ϊ sed µÄ£¨¼«Æ䣩¼ò»¯µÄ±äÌ壺Ëü¿ÉÒÔÓÃÒ»¸ö×Ö·ûÀ´Ìæ»»ÁíÒ»¸ö×Ö·û£¬»òÕß¿ÉÒÔÍêÈ«³ýȥһЩ×Ö·û¡£ÄúÒ²¿ÉÒÔÓÃËüÀ´³ýÈ¥Öظ´×Ö·û¡£Õâ¾ÍÊÇËùÓÐ tr ËùÄܹ»×öµÄ¡£
trÓÃÀ´´Ó±ê×¼ÊäÈëÖÐͨ¹ýÌæ»»»òɾ³ý²Ù×÷½øÐÐ×Ö·ûת»»¡£trÖ÷ÒªÓÃÓÚɾ³ýÎļþÖпØÖÆ×Ö·û»ò½øÐÐ×Ö·ûת»»¡£Ê¹ÓÃtrʱҪת»»Á½¸ö×Ö·û´®£º×Ö·û´®1ÓÃÓÚ²éѯ£¬×Ö·û´®2ÓÃÓÚ´¦Àí¸÷ÖÖת»»¡£tr¸ÕÖ´ÐÐʱ£¬×Ö·û´®1ÖеÄ×Ö·û±»Ó³Éäµ½×Ö·û´®2ÖеÄ×Ö·û£¬È»ºóת»»²Ù×÷¿ªÊ¼¡£
´øÓÐ×î³£ÓÃÑ¡ÏîµÄtrÃüÁî¸ñʽΪ£º
tr -c -d -s ["string1_to_translate_from"] ["string2_to_translate_to"] < input-file
ÕâÀ
-c ÓÃ×Ö·û´®1ÖÐ×Ö·û¼¯µÄ²¹¼¯Ìæ»»´Ë×Ö·û¼¯£¬ÒªÇó×Ö·û¼¯ÎªASCII¡£
-d ɾ³ý×Ö·û´®1ÖÐËùÓÐÊäÈë×Ö·û¡£
-s ɾ³ýËùÓÐÖظ´³öÏÖ×Ö·ûÐòÁУ¬Ö»±£ÁôµÚÒ»¸ö£»¼´½«Öظ´³öÏÖ×Ö·û´®Ñ¹ËõΪһ¸ö×Ö·û´®¡£
input-fileÊÇת»»ÎļþÃû¡£ËäÈ»¿ÉÒÔʹÓÃÆäËû¸ñʽÊäÈ룬µ«ÕâÖÖ¸ñʽ×î³£Óá£
2¡¢×Ö·û·¶Î§
Ö¸¶¨×Ö·û´®1»ò×Ö·û´®2µÄÄÚÈÝʱ£¬Ö»ÄÜʹÓõ¥×Ö·û»ò×Ö·û´®·¶Î§»òÁÐ±í¡£
[a-z] a-zÄÚµÄ×Ö·û×é³ÉµÄ×Ö·û´®¡£
[A-Z] A-ZÄÚµÄ×Ö·û×é³ÉµÄ×Ö·û´®¡£
[0-9] Êý×Ö´®¡£
\octal Ò»¸öÈýλµÄ°Ë½øÖÆÊý£¬¶ÔÓ¦ÓÐЧµÄASCII×Ö·û¡£
[O*n] ±íʾ×Ö·ûOÖظ´³öÏÖÖ¸¶¨´ÎÊýn¡£Òò´Ë[O*2]Æ¥ÅäOOµÄ×Ö·û´®¡£
trÖÐÌض¨¿ØÖÆ×Ö·ûµÄ²»Í¬±í´ï·½Ê½
ËټǷûº¬Òå°Ë½øÖÆ·½Ê½
\a Ctrl-G ÁåÉù\007
\b Ctrl-H Í˸ñ·û\010
\f Ctrl-L ×ßÐл»Ò³\014
\n Ctrl-J ÐÂÐÐ\012
\r Ctrl-M »Ø³µ\015
\t Ctrl-I tab¼ü\011
\v Ctrl-X \030
3¡¢Ó¦ÓÃÀý×Ó
£¨1£©È¥³ýoops.txtÀïÃæµÄÖظ´µÄСд×Ö·û
tr -s "[a-z]"result.txt
£¨2£©É¾³ý¿ÕÐÐ
tr -s "[\012]" < plan.txt »ò tr -s ["\n"] < plan.txt
£¨3£©ÓÐʱÐèҪɾ³ýÎļþÖеÄ^M£¬²¢´úÖ®ÒÔ»»ÐÐ
tr -s "[\015]" "[\n]" < file »ò tr -s "[\r]" "[\n]" < file
£¨4£©´óдµ½Ð¡Ð´
cat a.txt |tr "[a-z]" "[A-Z]" >b.txt
£¨5£©É¾³ýÖ¸¶¨×Ö·û
Ò»¸öÐÇÆÚµÄÈÕ³Ì±í¡£ÈÎÎñÊÇ´ÓÆäÖÐɾ³ýËùÓÐÊý×Ö£¬Ö»±£ÁôÈÕÆÚ¡£ÈÕÆÚÓдóд£¬Ò²ÓÐСд¸ñʽ¡£Òò´ËÐèÖ¸¶¨Á½¸ö×Ö·û·¶Î§[a-z]ºÍ[A-Z]£¬ÃüÁîtr -cs "[a-z][A-Z]" "[\012*]" ½«ÎļþÿÐÐËùÓв»°üº¬ÔÚ[a-z]»ò[A-Z]£¨ËùÓÐÏ£À°×Öĸ£©µÄ×Ö·û´®·ÅÔÚ×Ö·û´®1Öв¢×ª»»ÎªÒ»ÐÂÐС£-sÑ¡Ïî±íÃ÷ѹËõËùÓÐÐÂÐУ¬ -c±íÃ÷±£ÁôËùÓÐ×Öĸ²»¶¯¡£Ô­ÎļþÈçÏ£¬ºó¸útrÃü


Ïà¹ØÎĵµ£º

linux sock_rawԭʼÌ×½Ó×Ö±à³Ì

sock_rawԭʼÌ×½Ó×Ö±à³Ì¿ÉÒÔ½ÓÊÕµ½±¾»úÍø¿¨ÉϵÄÊý¾ÝÖ¡»òÕßÊý¾Ý°ü,¶ÔÓë¼àÌýÍøÂçµÄÁ÷Á¿ºÍ·ÖÎöÊǺÜÓÐ×÷ÓõÄ.Ò»¹²¿ÉÒÔÓÐ3ÖÖ·½Ê½´´½¨ÕâÖÖsocket
 
1.socket(AF_INET, SOCK_RAW, IPPROTO_TCP|IPPROTO_UDP|IPPROTO_ICMP)·¢ËͽÓÊÕipÊý¾Ý°ü
2.socket(PF_PACKET, SOCK_RAW, htons(ETH_P_IP|ETH_P_ARP|ETH_P_ALL))·¢ËͽÓÊÕÒÔÌ« ......

LinuxÐéÄâ»ú°²×°VMware Tools

LinuxÐéÄâ»úÏ°²×°VMware Tools
VMware ToolsËùÔÚλÖãº
VMware °²×°Â·¾¶
\VMware\VMwareWorkstation\linux.iso
1.ÐÞ¸ÄrootÓû§ÃÜÂë
10:32:36 zhangzhen@zhangzhen-desktop:~$ sudo passwd root
[sudo] password for zhangzhen:
ÊäÈëÐ嵀 UNIX ¿ÚÁ
ÖØÐÂÊäÈëÐ嵀 UNIX ¿ÚÁ
passwd£ºÒѳɹ¦¸üÐÂÃÜÂë
10:33 ......

LinuxÖÕ¶ËÌáʾ·ûPS1ÉèÖã¨ÑÕÉ«£©


\d £º´ú±íÈÕÆÚ£¬¸ñʽΪweekday month date£¬ÀýÈ磺"Mon Aug 1"
\H £ºÍêÕûµÄÖ÷»úÃû³Æ¡£ÀýÈ磺ÎҵĻúÆ÷Ãû³ÆΪ£ºfc4.linux£¬ÔòÕâ¸öÃû³Æ¾ÍÊÇfc4.linux
\h £º½öÈ¡Ö÷»úµÄµÚÒ»¸öÃû×Ö£¬ÈçÉÏÀý£¬ÔòΪfc4£¬.linuxÔò±»Ê¡ÂÔ
\t £ºÏÔʾʱ¼äΪ24Сʱ¸ñʽ£¬È磺HH£ºMM£ºSS
\T £ºÏÔʾʱ¼äΪ12Сʱ¸ñʽ
\A £ºÏÔʾʱ¼äΪ24 ......

ѧϰLinux(zhuan)

Ëæ×ÅLinuxÓ¦ÓõÄÀ©Õ¹Ðí¶àÅóÓÑ¿ªÊ¼½Ó´¥Linux£¬¸ù¾ÝѧϰWindwosµÄ¾­ÑéÍùÍùÓÐһЩãȻµÄ¸Ð¾õ£º²»Öª´ÓºÎ´¦¿ªÊ¼Ñ§Æð¡£ÕâÀï½éÉÜѧϰLinuxµÄһЩ½¨Òé¡£
Ò»¡¢´Ó»ù´¡¿ªÊ¼£º ³£³£ÓÐЩÅóÓÑÔÚLinuxÂÛ̳ÎÊһЩÎÊÌ⣬²»¹ý£¬ÆäÖдó¶àÊýµÄÎÊÌⶼÊǺܻù´¡µÄ¡£ÀýÈ磺ΪʲôÎÒʹÓÃÒ»¸öÃüÁîµÄʱºò£¬ÏµÍ³¸æËßÎÒÕÒ²»µ½¸ÃĿ¼£¬ÎÒÒªÈçºÎÏÞÖÆÊ¹Ó ......

linux »ù±¾ÃüÁî

ʹÓÃTAB¼ü
ÓÃÊó±ê¿½±´ºÍÕ³ÌùÌá¸ß²Ù×÷ËÙ¶È     ×ó¼üÍ϶¯---¿½±´    Öмüµã»÷---Õ³Ìù
1¡¢mkdir ½¨Á¢ÐÂĿ¼Ãû    ¼Ó“." ÔÚĿ¼ÃûǰΪÒþ²ØĿ¼£¨ls -a¿É²é¿´£©
     rm -rf Ŀ¼Ãû   ɾ³ýĿ¼¼°×ÓĿ¼  rm -- -eeɾ³ý-eeÎļþ  »òÕß rm "ÎļþÃû"

2¡¢m ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ