当前位置: 技术问答>linux和unix
文件结果横向输入文件
来源: 互联网 发布时间:2016-08-05
本文导语: cd /zhjs4/data/databackup/ctjs/H_CC08_LS ll H01060349* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct ll H01060350* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct ll H01060351* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| g...
cd /zhjs4/data/databackup/ctjs/H_CC08_LS
ll H01060349* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct
ll H01060350* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct
ll H01060351* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct
ll H01060352* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct
ll H01060353* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct
ll H01060354* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct
ll H01060355* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct
ll H01060356* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct
ll H01060357* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct
ll H01060358* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct
ll H01060359* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct
各位高手,我现在想实现如下功能:
1.将上述语句产生的结果横向输入到.txt文件,只要后面的a[i]文件个数,文件标题为日期,最终格式如下:
日期
地市 1 2 3 。。。。。。。。。31
0349 a[i]....
0351
0352
请各位帮忙!不尽感激
ll H01060349* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct
ll H01060350* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct
ll H01060351* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct
ll H01060352* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct
ll H01060353* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct
ll H01060354* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct
ll H01060355* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct
ll H01060356* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct
ll H01060357* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct
ll H01060358* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct
ll H01060359* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct
各位高手,我现在想实现如下功能:
1.将上述语句产生的结果横向输入到.txt文件,只要后面的a[i]文件个数,文件标题为日期,最终格式如下:
日期
地市 1 2 3 。。。。。。。。。31
0349 a[i]....
0351
0352
请各位帮忙!不尽感激
|
ll H01060349* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct |sort -k1.4n,1.5n| awk '{f1=f1" "$1;f2=f2" "$2}END{print f1"n"f2}'
|
没你的目录,没有你的文件,别人不可能看见你要什么效果,你自己试试:
for I in $(seq 349 359); do
echo -n $I
for D In $(ll H01060$I* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct); do
echo -n " "$D
done
done
|
for I in $(seq 349 359); do
echo -n $I
DATA=$(ll H01060$I* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct)
for D in $(seq 1 31); do
N=$(printf "%s" "$DATA" | grep "Oct$D ")
if [ ! -z "$N" ] ; then
echo -n $(echo $N | cut -f 2 -d " ")" "
else
echo -n "0 "
fi
done
echo
done
echo -n $I
DATA=$(ll H01060$I* | awk '{a[$6$7]++};END{for(i in a) print i,a[i]}'| grep Oct)
for D in $(seq 1 31); do
N=$(printf "%s" "$DATA" | grep "Oct$D ")
if [ ! -z "$N" ] ; then
echo -n $(echo $N | cut -f 2 -d " ")" "
else
echo -n "0 "
fi
done
echo
done