|
发表于 2003-12-5 16:29:22
|
显示全部楼层
[/home/javalee/myshell]cat data #这是我作的一个"样本文件"
20030825|1231005010|1231005010|200000.0|6.3
20030829|1231017864|1231017864|10000.0|6.975
20030827|1231017911|1231017911|200000.0|6.6375
20030828|1231021548|1231021548|20000.0|6.975
20030824|1231023511|1231023511|15000.0|6.3
20030823|1231024763|1231024763|10000.0|7.3125
20030822|1231030010|1231030010|60000.0|7.3125
20030821|1231042038|1231042038|40000.0|6.6375
20030820|1231042190|1231042190|20000.0|6.975
20030826|1231053035|1231053035|30000.0|6.975
20030819|1231053510|1231053510|50000.0|6.975
20030818|1231054277|1231054277|50000.0|6.6375 - [/home/javalee/myshell]cat sd
- #!/bin/ksh
- read date?"您要哪天的数据(e.g. 20030811):"
- read day?"您要几天的数据(e.g. 8):"
- sort data|grep -A$day "\<$date\>"
复制代码结果:
[/home/javalee/myshell]ksh sd
您要哪天的数据(e.g. 20030811):20030823
您要几天的数据(e.g. 8):4
20030823|1231024763|1231024763|10000.0|7.3125
20030824|1231023511|1231023511|15000.0|6.3
20030825|1231005010|1231005010|200000.0|6.3
20030826|1231053035|1231053035|30000.0|6.975
20030827|1231017911|1231017911|200000.0|6.6375
[/home/javalee/myshell] 不知道是不是这个意思~~
BTW: :sorry,你的贴子我删多啦~~ |
|