Skip to main content

BASH foo


Update a file named after a "system" with the IP address from a ":" delimited text file.
system:192.168.0.100
cat list | awk -F\: '{ print $1" "$2 }' | while read SYS IP; do echo "address $IP" >> ${SYS}.cfg ; done


- Passing responses in to an install script
( echo NB_CLT_7.5.0.6; echo y; echo q; echo y ) | ./NB_update.install


This.. is awesome
To get the text between two 'strings'

 cat sar11 |  awk '/plist-sz/,/Average/ '
00:00:01      runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15
00:01:01            2       998      1.14      0.38      0.18
00:02:01            1      1006      2.35      0.91      0.38
00:03:01            1       998      1.63      0.97      0.43
--- --- ---  ---
 23:52:01            0       974      0.30      0.19      0.19
23:53:01            1       972      0.40      0.23      0.20
Average:            1       912      1.19      1.19      1.16

Comments