2019年4月21日日曜日

sed awk

#1 sed 's/CN//' s1 > S1



sed -i 's|/usr/libexec/|/usr/lib/ibus-mozc/|g'









awk '{sub(/^[ \t]+/, ""); print}' s1 > spammers.txt-NoSpace

https://qiita.com/yamazon/items/563af1b485ff413d381f より

#2 echo 1:2/3:4 |awk -F'[:/]' '{print $1,$2}'

dell# ifconfig | grep 192 | awk  '{print $2}'          
192.168.17.17


dell# ifconfig |grep 192 | awk -F'[ ]' '{print $1,$2}'

inet 192.168.17.17




 
 ./comment-out.bat /etc/samba/smb.conf-ori | ./comment-out.bat- 


comment-out.bat
awk '$1 !~ "#"{print}' $1 | awk 'NF >0 {print}' -

comment-out.bat-

awk '$1 !~ ";"{print}' $1 | awk 'NF >0 {print}' -





  1. sed -> https://qiita.com/mattintosh4/items/4e4d44016be15333af11