linuxsed文件內容
發布時間: 2024-11-02 23:15:41
① 濡備綍鍦↙inux涓浣跨敤sed鍛戒護鍦ㄦ枃浠剁壒瀹氳屽悗娣誨姞鍐呭癸紵
Linux涓鐨剆ed鍛戒護鏄涓縐嶅己澶х殑鏂囨湰澶勭悊宸ュ叿錛岄氳繃鑴氭湰鎿嶄綔瀹炵幇瀵規枃鏈鏂囦歡鐨勭紪杈戝拰杞鎹銆傚叾涓昏佸姛鑳藉寘鎷鑷鍔ㄥ寲鏂囦歡緙栬緫銆佺畝鍖栭噸澶嶆搷浣滃拰緙栧啓杞鎹㈢▼搴忋傚熀鏈璇娉曟牸寮忎負錛歴ed [鍙傛暟]錛屽叾涓涓浜涘父鐢ㄧ殑鍙傛暟鍖呮嫭錛
- -e鎴--expression=script錛氱洿鎺ュ湪鍛戒護涓鎸囧畾鑴氭湰澶勭悊鏂囨湰鏂囦歡銆
- -fscript鏂囦歡鎴--file=script鏂囦歡錛氫嬌鐢ㄥ栭儴鑴氭湰鏂囦歡榪涜屽勭悊銆
- -h鎴--help錛氭樉紺哄府鍔╀俊鎮浠ヤ簡瑙e懡浠ょ敤娉曘
- -n鎴--quiet鎴--silent錛氫粎鏄劇ず澶勭悊鍚庣殑緇撴灉錛屼笉鏄劇ず榛樿ょ殑琛屽彿銆
- -V鎴--version錛氭煡鐪媠ed鐨勭増鏈淇℃伅銆
涓嬮潰鏄涓浜涘疄闄呮搷浣滅殑渚嬪瓙錛
- 鍦╢ile鏂囦歡鐨勭鍥涜屽悗鎻掑叆涓琛岋細鈥淗ELLO LINUX! Linux is a free unix-type operating system. This is a Linux test file!鈥濓細sed -e Ɗa ewlineHELLO LINUX! Linux is a free unix-type operating system. This is a Linux test file!' file
- 鍒楀嚭/dir鐩褰曞唴瀹癸紝鍒犻櫎絎2~5琛岋紝鍚屾椂鏄劇ず琛屽彿錛歯l/dir | sed ƈ,5d'
- 鍦ㄧ浜岃屽悗闈㈡坊鍔犱袱琛屾枃瀛楋細鈥淒rink tea or 鈥..鈥濆拰鈥渄rink beer鈥濓細nl/dir | sed ƈaDrink tea or ......drink beer?'
- 灝嗙2-5琛屾浛鎹涓衡淣O 2-5 number鈥濓細nl/dir | sed ƈ,5cNO2-5number'
- 鎸夎屼負鍗曚綅鏄劇ず絎5鍒7琛岋細nl/dir | sed -n Ƌ,7p'
閫氳繃榪欎簺瀹炰緥錛宻ed鍛戒護鐨勫己澶у姛鑳藉拰鐏墊椿鎬у湪鏂囨湰鏂囦歡鐨勫勭悊涓鏄懼緱灝や負鏄捐憲錛岃兘澶熸弧瓚沖悇縐嶅嶆潅鐨勬枃鏈鎿嶄綔闇奼傘
熱點內容