用script 讀檔然後做變數 - Linux

By Frederic
at 2012-04-06T11:20
at 2012-04-06T11:20
Table of Contents
PATH=$PATH
export PATH
cat ttest.dat | awk '{total = $1 + $2 + $3 + $4;
printf "%d %d %d %d %d\n", $1, $2, $3, $4, total; system("echo " total)}'
echo "$total"
if ["$total" -le "20" ]; then
pwd
fi
exit 0
ttest.dat內容
10 10 10 10
11 11 11 11
5 5 5 1
為什麼awk執行完後 我的total裡面就什麼都沒有了。
要怎麼修改我的pwd才會執行到?
謝謝
--
export PATH
cat ttest.dat | awk '{total = $1 + $2 + $3 + $4;
printf "%d %d %d %d %d\n", $1, $2, $3, $4, total; system("echo " total)}'
echo "$total"
if ["$total" -le "20" ]; then
pwd
fi
exit 0
ttest.dat內容
10 10 10 10
11 11 11 11
5 5 5 1
為什麼awk執行完後 我的total裡面就什麼都沒有了。
要怎麼修改我的pwd才會執行到?
謝謝
--
Tags:
Linux
All Comments

By Thomas
at 2012-04-09T16:43
at 2012-04-09T16:43

By Valerie
at 2012-04-12T17:19
at 2012-04-12T17:19

By Caroline
at 2012-04-16T15:48
at 2012-04-16T15:48

By Suhail Hany
at 2012-04-20T17:54
at 2012-04-20T17:54

By Ethan
at 2012-04-23T03:04
at 2012-04-23T03:04

By Skylar Davis
at 2012-04-27T01:33
at 2012-04-27T01:33
Related Posts
dl.google.com的更新變很慢

By Noah
at 2012-04-06T05:21
at 2012-04-06T05:21
glibc

By Mason
at 2012-04-05T21:41
at 2012-04-05T21:41
在mac的parallels安裝B2D問題..

By Hedda
at 2012-04-05T21:08
at 2012-04-05T21:08
C compiler cannot create executables

By Cara
at 2012-04-05T20:23
at 2012-04-05T20:23
關於光碟中的autorun.sh

By Bethany
at 2012-04-05T18:12
at 2012-04-05T18:12