- 论坛徽章:
- 0
|
解难题:如何把这样一个文件按照里面的内容分成许多小文件?
? !! I did test my program before I post.
Did you misreplace operator ">>" with operator ">", that will cause your every recrod file only one line.
">>" means : append content
">" means: write/rewrite content
Why don't you just copy and paste my code on your machine, and execute it?
here is the result on my machine:
- echo 'for i in $(ls *_Record.txt); do echo [$i:];cat $i;echo; done' | sh
复制代码
[Chenying_Record.txt:]
IDChenying_26613 82 96 100
Shanghai school 1983-1989
Shanghai highschool 1989-1994
Beijing QHU 1994-1998
Beijing MPH 1998-now
[Lihong_Record.txt:]
IDLihong_16542 76 84 92
Beijing school 1982-1988
Tianjing highschool 1998-1993
Beijing BNU 1993-1998
[Zhangdong_Record.txt:]
IDZhangdong_15525 72 86 80
Shandong school 1983-1989
Shandong highschool 1989-1994
Beijing BNU 1994-1998 |
|