Recently in Shell Category

SADDR=台中市中區中山路1號
DADDR=台中市西屯區文華路100號
w3m -dump "http://maps.google.com.tw/maps?saddr=$SADDR&daddr=$DADDR" | egrep "公里.*大約"

輸出結果:
8.3 公里 - 大約 24 分鐘

[Linux] Turn All Services Off

user-pic
Vote 0 Votes

chkconfig --list | awk '/0:/{system("chkconfig "$1" off")}'

Linux 安裝好預設會開一些 Service, 若用不到就先全關, 再開自己要的.
chkconfig crond on
chkconfig network on
chkconfig syslog on
chkconfig sshd on

Using shell variable in awk

user-pic
Vote 0 Votes

Shell variable must within single-quotes in awk command, just like '$A'

e.g. File fruit.txt content as follow
apple 99
orange 25
lemon 30

FRUIT=apple, To get number after $FRUIT
awk '/'$FRUIT'/ {print $2}' fruit.txt (Rignt)
awk '/$FRUIT/ {print $2}' fruit.txt (Wrong, not work)

About this Archive

This page is an archive of recent entries in the Shell category.

Programming is the previous category.

Software is the next category.

Find recent content on the main index or look in the archives to find all content.