Terminal初心者質問スレ Part 4
■ このスレッドは過去ログ倉庫に格納されています
0658657
04/12/27 19:47:48ID:oXt0t1qu最後、rmで余計なものを削除していたり、完全なscriptとは到底言えませんが、
今後ぼちぼち改善していこうと思います。やっぱperlですかね。
#!/bin/sh
txt=`curl -s http://www.kakaku.com/bbs/menumaker.asp?CategoryCD=2027`
sum=`echo "$txt" | grep \"Main.asp | cut -f2 -d\( | sed 's/[^0-9]//g'`
tos=`echo "$txt" | grep TOSHIBA | cut -f2 -d\( | sed 's/[^0-9]//g'`
pan=`echo "$txt" | grep PANASONIC | cut -f2 -d\( | sed 's/[^0-9]//g'`
son=`echo "$txt" | grep SONY | cut -f2 -d\( | sed 's/[^0-9]//g'`
pio=`echo "$txt" | grep PIONEER | cut -f2 -d\( | sed 's/[^0-9]//g'`
sha=`echo "$txt" | grep SHARP | cut -f2 -d\( | sed 's/[^0-9]//g'`
vic=`echo "$txt" | grep VICTOR | cut -f2 -d\( | sed 's/[^0-9]//g'`
mit=`echo "$txt" | grep MITSUBISHI | cut -f2 -d\( | sed 's/[^0-9]//g'`
hit=`echo "$txt" | grep HITACHI | cut -f2 -d\( | sed 's/[^0-9]//g'`
nec=`echo "$txt" | grep NEC | cut -f2 -d\( | sed 's/[^0-9]//g'`
den=`echo "$txt" | grep DENON | cut -f2 -d\( | sed 's/[^0-9]//g'`
fun=`echo "$txt" | grep FUNAI | cut -f2 -d\( | sed 's/[^0-9]//g'`
san=`echo "$txt" | grep SANYO | cut -f2 -d\( | sed 's/[^0-9]//g'`
jcc=`echo "$txt" | grep JCC | cut -f2 -d\( | sed 's/[^0-9]//g'`
ken=`echo "$txt" | grep KEN | cut -f2 -d\( | sed 's/[^0-9]//g'`
echo "$txt" | grep menuproduct.asp | cut -f4 -f5 -d\> | sed 's/<\/a> (/ /g' | sed "s/)<\/font//g" | sort +1nr | cat -n > sh/file1.txt
{ printf "%.1f\n" `echo "scale=1; $tos * 100 / $sum" | bc` ; printf "%.1f\n" `echo "scale=1; $pan * 100 / $sum" | bc` ; 以下略 } > sh/file2.txt
paste sh/file1.txt sh/file2.txt > sh/file3.txt
paste -d \% sh/file3.txt sh/bc.txt
rm sh/file1.txt
rm sh/file2.txt
rm sh/file3.txt
■ このスレッドは過去ログ倉庫に格納されています