跳至內容
[[
other:awk-sed
]]
脆笛酥的家
足跡:
顯示頁面
管理選單
最近更新
網站地圖
登入
搜尋
本頁是唯讀的,您可以看到原始碼,但不能更動它。您如果覺得它不應被鎖上,請詢問管理員。
===== some awk & sed script ===== ==== mrtg ==== 大量重新命名 mrtg output 檔案 <code shell> find . -iname "1.1.1.1_*" | awk -F "_" '{print "mv 1.1.1.1_" $2 " 2.2.2.2_" $2}' | sh </code> all-in-one command for cfgmaker <code> cfgmaker --snmp-options=:::::2 --global "WorkDir: /home/hosts/www/mrtg/html/idc/Juniper" --global "Options[_]: growright, bits" --global "Language: big5" --global 'AddHead[_]:<script type="text/javascript" src="//mrtg.jal.tw/google_analytics.js"></script>' --zero-speed=1000000000 --show-op-down --if-filter='$if_type!=1 && $if_type!=53 && $if_type!=24 && $if_type!=131 && $if_type!=135 && $if_type!=136 && $if_type!=137 && $if_type!=142 && $if_type!=150 && $if_type!=217 && $if_type!=218 && $if_type!=222 && $if_type!=223' public@8.8.8.8 --output=Juniper.cfg </code> Replace sensitive information after index page build. <code> /usr/bin/sed -i '' -e 's/iso-8859-15/big5/g' */*/index.html /usr/bin/sed -i '' '/Command line/d' */*/index.html /usr/bin/sed -i '' '/Command-Line/d' */*/index.html /usr/bin/sed -i '' '/commandline/d' */*/index.html /usr/bin/sed -i '' '/HTTP-EQUIV="Expires"/d' */*/index.html /usr/bin/sed -i '' '/.switchs.jal.tw/d' */*/index.html </code> ==== named (bind) ==== Replace bind zone file serial number with increased serial number. Complete script: [https://github.com/jal-tw/dnssec-reissue-and-bind-reload|Github] <code php> <?php $zone_file = "/usr/local/etc/namedb/master/jal.tw"; $serial = exec ("/usr/bin/grep serial $zone_file | /usr/bin/awk '{print $1}'"); $new_serial = $serial + 1; "/usr/bin/sed -i '' -e 's/$serial/$new_serial/g' $zone_file"; ?> </code>
顯示頁面
舊版
多媒體管理器
回到頁頂