033_ch8 習題解答

8 views
Skip to first unread message

張明泰

unread,
Jul 23, 2008, 8:41:29 AM7/23/08
to lccnet9407
#!/bin/bash
for NAME in $(cat gen.txt)
do
# echo $NAME
a1=$(echo $NAME | cut -d, -f1)
a2=$(echo $NAME | cut -d, -f2)
a3=$(echo $NAME | cut -d, -f3)
a4=$(echo $NAME | cut -d, -f4)
a5=$(echo $NAME | cut -d, -f5)
# echo $a1,$a2,$a3,$a4,$a5
echo "INSERT INTO qa.lime_old_tokens
( tid ,firstname ,lastname ,email ,emailstatus
,token ,language ,sent ,completed ,attribute_1 ,attribute_2 ,mpid)VALUES
('LAST_INSERT_I
D', '$a2', '$a4', '$a...@student.nsysu.edu.tw', 'OK', NULL , 'zh-Hant-
TW', 'N', 'N', NULL
, NULL , 'NULL'); ";
done

張明泰

unread,
Jul 27, 2008, 2:41:50 AM7/27/08
to lccnet9407
請使用 sed 指令配合 Regular Expression 抓出你的網路卡的 ip 。

[root@station20 test]# ifconfig | grep 'inet addr' | sed 's/^.*addr://
g' |sed 's/Bcast.*$//g' | sed 's/Mask.*$//g'
192.168.1.69
127.0.0.1
Reply all
Reply to author
Forward
0 new messages