- 论坛徽章:
- 0
|
bitext_200601.txt:
200601
bitext_200602.txt:
200602
bitext_200603.txt:
200603
testaa.txt:
abcd200601 11111
abcd200602 22222
abcd200603 33333
abcd200604 44444
abcd200605 55555
abcd200601 66666
abcd200603 77777
abcd200601 88888
-------------------------------------------------------------------------------------------
程式:
re_file=$(ls bitext_??????.txt)
for file in $re_file
do
bcmonth=`cat $file`
echo $bcmonth
awk '{if(substr($1,5,10)=='"'$bcmonth'"') print $2}' testaa.txt > testbb_${bcmonth}.txt
done
-------------------------------------------------------------------------------------------
希望得到結果 :
testbb_200601.txt :
abcd200601 11111
abcd200601 66666
abcd200601 88888
testbb_200602.txt :
abcd200602 22222
testbb_200603.txt :
abcd200603 33333
abcd200603 77777
-------------------------------------------------------------------------------------------
執行程式沒有結果,
請教要如何修改程式呢?? |
|