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

sed ÃüÁîÍêÈ«½âÎö Ö®linux¸ß¼¶ÃüÁî

sed ±à¼­Ö¸ÁîµÄ¸ñʽÈçÏ :
sed option [address1[,address2]]function[argument] ***.c
λַ²ÎÊý address1/2 ΪÐÐÊý»òÆ¥Åä×Ö´® , ±íʾËùÖ´Ðб༭µÄÐÐ ;
º¯Êý²Î Êý function[argument] Ϊ sed µÄÄÚ¶¨º¯Êý , ±íʾִÐеı༭¶¯×÷¡£
 
Æ¥Åä×Ö´®£º£¨reguler expression ×Ö´®£©
& : ´ú±íÆäÇ° pattern ×Ö´®
Àý£ºsed -e 's/test/& my car/' ó sed -e 's/test/test my car/'
/t.*t/d £º"." ±íʾÈÎÒâ×ÖÔª; "*" ±íʾµ±Ç°×ÖÔª¿ÉÖØÈÎÒâ´Î , ËüÃǽáºÏ ".*" ±íʾÁ½ "t" ×Öĸ¼äµÄÈÎÒâ
^ : ´ú±íµ±Ç°ÐÐÊ×
$ : ´ú±íµ±Ç°ÐÐβ
 
³£ÓÃoption
-i ´ËÑ¡Ïî¿ÉÒÔ×Ô¶¯°ÑÐ޸Ľá¹û±£´æµ½ÎļþÖУ¬²»È»»á´òÓ¡µ½stdout
-n ¾ÍÊDz»°ÑÎļþ´òÓ¡µ½±ê×¼Êä³ö¡£
-e ¿ÉÒÔ¶à¸öÃüÁîÒ»ÆðʹÓã¬ÓÃËüÁ¬ÆðÀ´¾ÍºÃÁË
 
ÒýºÅÄÚµÄÃüÁ
s Ìæ»»
d ɾ³ý
a Ìí¼Ó
p ´òÓ¡
r ¶ÁÈëËüµµÄÚÈÝ
w д×ÊÁϵ½ËüµµÄÚ
a\ Ìí¼Ó×Ö·û´®£¬ÊäÈëµÄ×ÊÁϱØÐë´ÓÏÂÒ»ÐÐÊäÈë
 
1 ÔÚÿһÐпªÊ¼´¦²åÈë5¸ö¿Õ¸ñ(ÕûҳƫÒÆ)
¡¡¡¡sed –i’s/^/ /’ test.c
2 ɾ³ýÿһÐпªÍ·µÄ¿Õ°×(¿Õ¸ñ£¬TAB)×ó¶ÔÆëÅÅÁÐÈ«ÎÄ
sed  -i 's/^[ t]*//' test.py
^[ \t]* µÄº¬ÒåΪÒÔ¿Õ¸ñ»òÕßTAB¼ü¿ªÊ¼µÄ(»òÕßÊÇËûÃǵÄ×éºÏ)ÐÐ
3 ÔÚÿһº¬ÓÐ"baz"µÄÐÐÖÐÓÃ"bar"Ìæ»»(²éÕÒ²¢Ìæ»»)foo"
¡¡¡¡sed –i ’/baz/s/foo/bar/g’
4ÔÚÿһº¬ÓÐ"baz"µÄÐÐÖÐÓÃÐÐÊ×¼Ó×¢ÊÍ
   sed –i '/ baz /s/^/#/g'
5 ɾ³ýÁ½¸ö×Ö·û´®Ö®¼äµÄÐÐ
Sed  -i  ‘/abc/,/123/d’ test.c
Sed  -i  ‘2,10d’ ɾ³ý2µ½10ÐÐ
6 ÔÚµ±Ç°ÐеÄÏÂÒ»ÐвåÈëÎļþ
Sed  -i  ‘/hello/a\ ******’
 


Ïà¹ØÎĵµ£º

LinuxÉ豸ģÐÍÖ®input×ÓϵͳÏê½â

Ò»£ºÇ°ÑÔ
×î½üÔÚÑо¿androidµÄsensor driver£¬Ö÷ÒªÊÇE-compass£¬ÆäÖÐÓõ½ÁËLinux input×Óϵͳ.ÔÚÍøÉÏÒ²¿´Á˺ܶàÕâ·½ÃæµÄ×ÊÁÏ£¬¸Ð¾õ»¹ÊÇÕâƪ·ÖÎöµÄ±È½ÏϸÖÂ͸³¹£¬Òò´ËתÔØÒ»ÏÂÒÔ±ã×Ô¼ºÑ§Ï°£¬Í¬Ê±ºÍ´ó¼Ò·ÖÏí£¡
£¨Õâƪ²©¿ÍÖ÷ÒªÊÇÒÔ¼üÅÌÇý¶¯ÎªÀýµÄ£¬²»¹ý½²½âµÄÊÇLinux Input Subsystem£¬¿ÉÒÔ×ÐϸµÄÑо¿Ò»Ï£¡£©
¼üÅÌÇý¶¯½«¼ì ......

WindowsϵÄLinux¿ª·¢ Cygwin 1.7.1 ·¢²¼

CygwinÊÇÐí¶à×ÔÓÉÈí¼þµÄ¼¯ºÏ£¬×î³õÓÉCygnus Solutions¿ª·¢£¬ÓÃÓÚ¸÷ÖÖ°æ±¾µÄMicrosoft WindowsÉÏ£¬ÔËÐÐUNIXÀà
ϵͳ¡£CygwinµÄÖ÷ҪĿµÄÊÇͨ¹ýÖØбàÒ룬½«POSIXϵͳ£¨ÀýÈçLinux¡¢BSD£¬ÒÔ¼°ÆäËûUnix
ϵ
ͳ£©ÉϵÄÈí¼þÒÆÖ²µ½WindowsÉÏ¡£CygwinÒÆÖ²¹¤×÷ÔÚWindows NT¡¢Windows 2000¡¢Windows
XPÒÔ¼°Windows Server 2003ÉϱȽϺ ......

linux»·¾³±äÁ¿Ïà¹Ø


ÎÒÃÇÔÚLinuxÏ°²×°ÏµÍ³Èí¼þµÄʱºò,¾­³£Óöµ½Ò»Ð©ÏµÍ³»·¾³±äÁ¿ÅäÖõÄÎÊÌ⡣ʲôÊÇ»·¾³±äÁ¿£¿ÈçºÎ¶¨ÖÆ»·¾³±äÁ¿£¿ÎÒ½«ÔÚÏÂÃæ×öһЩ½éÉÜ¡£
Ò»¡¢Ê²Ã´ÊÇ»·¾³±äÁ¿£¿
LinuxÊÇÒ»¸ö¶àÓû§µÄ²Ù×÷ϵͳ¡£¶àÓû§Òâζ×Åÿ¸öÓû§µÇ¼ϵͳºó£¬¶¼ÓÐ×Ô¼º×¨ÓõÄÔËÐл·¾³¡£¶øÕâ¸ö»·¾³ÊÇÓÉÒ»×é±äÁ¿Ëù¶¨Òå,Õâ×é±äÁ¿±»³ÆΪ»·¾³±äÁ¿¡£Óû§¿ÉÒÔ¶Ô×Ô ......

LinuxϵĶδíÎóµÄÔ­Òò¼°µ÷ÊÔ

¼ò¶øÑÔÖ®,²úÉú¶Î´íÎó¾ÍÊÇ·ÃÎÊÁË´íÎóµÄÄÚ´æ¶Î£¬Ò»°ãÊÇÄãûÓÐȨÏÞ£¬»òÕ߸ù±¾¾Í²»´æÔÚ¶ÔÓ¦µÄÎïÀíÄÚ´æ,ÓÈÆä³£¼ûµÄÊÇ·ÃÎÊ0µØÖ·.
Ò»°ãÀ´Ëµ,
¶Î´íÎó¾ÍÊÇÖ¸·ÃÎʵÄÄڴ泬³öÁËϵͳËù¸øÕâ¸ö³ÌÐòµÄÄÚ´æ¿Õ¼ä£¬Í¨³£Õâ¸öÖµÊÇÓÉgdtrÀ´±£´æµÄ£¬ËûÊÇÒ»¸ö48λµÄ¼Ä´æÆ÷£¬ÆäÖеÄ32λÊDZ£´æÓÉËüÖ¸ÏòµÄ
gdt±í£¬ºó13λ±£´æÏàÓ¦ÓÚgdtµÄϱ꣬×îºó3 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ