sed in MacOS

1, use G command to add a new line

2, use parameter in substitution command

dig +short

sudo cp /etc/pf.conf /etc/pf.conf_bak`date +%Y%m%d%H%M%S`

output_cmd="pass out proto tcp from any to ${1} port ${2}"

sudo sed -i '' -e '${G;}' /etc/pf.conf

sudo sed -i '' -e "$ s/$/$output_cmd/" /etc/pf.conf

sudo pfctl -evf /etc/pf.conf


root@vic2cc:~/vim_practice# awk 'NR==FNR{a[NR]=$0} NR!=FNR{print a[FNR],$0}' acc res     
001 wx nt1
002 wx ne2
003 wx ne3
root@vic2cc:~/vim_practice# awk '{a[NR]=$0} NR!=FNR{print a[FNR],$0}' acc res        
001 wx nt1
002 wx ne2
003 wx ne3
root@vic2cc:~/vim_practice# awk 'FILENAME=="acc"{a[NR]=$0}FILENAME=="res"{print a[FNR],$0}' acc res
001 wx nt1
002 wx ne2
003 wx ne3

some op record

iptables must have the double channel for communication


pip install psutil -i –trusted-host


salt '' "python /tmp/" –async

salt "" saltutil.kill_job 20171127165031008707

sudo salt '*' grains.item saltpath username os

saltutil.sync_modules refresh

sudo salt-run jobs.list_job 'jobid'

kill salt progress and restsart in front

launchctl unload /Library/LaunchDaemons/com.saltstack.salt.minion.plist


maybe the salt should run in front while meeting some error

rsync pay attention the rsync.pas auth 644

check last update node info by salt in 86 cdn manager:

sudo salt -N cdn_node_all "grep -o '/raid/wwwroot/Q7/win/enginepatch' /opt/cdnsynctool/CDNSyncTool/common/"

check salt start user auth, and launchctl unload and restart

powershell about

svn st | select-string -pattern "^C"

svn revert -R .\image