linux涓夊ぇ鍒╁櫒–grep|sed|awk

grep

grep 姣旇緝绠鍗 鏌ユ壘鏂囨湰绂讳笉寮姝e垯 鍏蜂綋鐢ㄦ硶濡備粠绠鍗曞埌澶嶆潅濡
grep '[1-9]' 鏂囦欢鍚 //鍖归厤鍚湁1鍒9鏁板瓧
grep '[^1-9]' 鏂囦欢鍚 //鍖归厤闄や簡1-9鏁板瓧鐨勫叾浠栧瓧绗
grep '^root' 鏂囦欢鍚 //^鍙樻垚澶村瓧绗 浠oot寮澶
grep '^$' 鏂囦欢鍚 //澶村拰灏惧姞璧锋潵 鍖归厤绌鸿
grep '\.' 鏂囦欢鍚 //鍖归厤.
grep '\w' 鏂囦欢鍚 //绛夊悓([a-zA-Z1-9_])
grep '\W' 鏂囦欢鍚 //绛夊悓([^a-zA-Z1-9_])
grep '\b' 鏂囦欢鍚 //琛ㄧず鍗曡瘝鍒嗛殧 濡 \b[a]\b 灏辨槸a
grep 'sb\+' 鏂囦欢鍚 //鍖归厤鑷冲皯鍑虹幇涓娆$殑sb
grep 'sb*' 鏂囦欢鍚 //鏈塻鎴栬卋閮藉彲浠
grep '.' 鏂囦欢鍚 //鍖归厤浠绘剰瀛楃

sed

sed鐨勬牸寮

sed [options] 鈥榗ommand鈥 file(s) //鍛戒护琛屾牸寮
sed 'p' passwd #浼氭墦鍗板嚭涓よ,鍥犱负sed鐨勫師鐞嗘槸璇诲叆涓琛岋紝杈撳嚭涓琛岋紝姝ゅ鍐嶅姞涓妏鍛戒护鎵撳嵃鍑烘潵鐨勪竴琛岋紝鎵浠ユ渶鍚庝細鎵撳嵃鍑轰袱琛
sed -n 'p'passwd #鍔犱簡-n閫夐」涔嬪悗锛屽彧浼氭墦鍗板嚭鐩稿叧鐨勮锛岄偅浜涗笉鐩稿叧鐨勮鍒欎笉浼氭墦鍗板嚭鏉

All posts

Other pages

鍙戣〃璇勮

鐢靛瓙閭欢鍦板潃涓嶄細琚叕寮銆 蹇呭~椤瑰凡鐢*鏍囨敞