sed in MacOS

1, use G command to add a new line

https://stackoverflow.com/questions/6111679/insert-linefeed-in-sed-mac-os-x/6112034

2, use parameter in substitution command

https://stackoverflow.com/questions/34969408/path-substitution-with-sed-and-shell-variables-on-os-x

dig +short baidu.com

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

awk

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
root@vic2cc:~/vim_practice#

some op record

iptables must have the double channel for communication


salt

pip install psutil -i http://apt.2980.com/pypi/simple –trusted-host apt.2980.com

salt-run jobs.active

salt '10.17.65.229' cmd.run "python /tmp/test.py" –async

salt "10.17.65.229" 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

salt-minion

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 cmd.run "grep -o '/raid/wwwroot/Q7/win/enginepatch' /opt/cdnsynctool/CDNSyncTool/common/ComDef.py"


check salt start user auth, and launchctl unload and restart

powershell about

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

svn revert -R .\image