免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3081 | 回复: 9
打印 上一主题 下一主题

SHELL 读取文本的问题。。。。。 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-08-11 16:25 |只看该作者 |倒序浏览
#! /bin/bash
while read TABNAME
do
TMPFILE=/home/vbsdep/upperc/ALS6_XD/${TABNAME}.tmp

cdate=$(date +%Y%m%d)
file=$TMPFILE
sed -f scr.sed $file | awk 'BEGIN{ FS = "\""; OFS = ""}{for(i=1;i<=NF;i++) if ( i%2) gsub(/,/,"|",$i); print}' > $cdate$file   && to
uch /home/vbsdep/upperc/ALS6_XD/$cdate$file.OK
done<scroollist.sh

这个SHELL为什么执行以后报错:
./test1.sh: line 8: 20080811/home/vbsdep/upperc/ALS6_XD/IND_INFO.tmp: A file or directory in the path name does not exist.
sed: 0602-419 Cannot find or open file /home/vbsdep/upperc/ALS6_XD/IND_INFO.tmp.
./test1.sh: line 8: 20080811/home/vbsdep/upperc/ALS6_XD/ENT_INFO.tmp: A file or directory in the path name does not exist.
sed: 0602-419 Cannot find or open file /home/vbsdep/upperc/ALS6_XD/ENT_INFO.tmp.
./test1.sh: line 8: 20080811/home/vbsdep/upperc/ALS6_XD/CUSTOMER_INFO.tmp: A file or directory in the path name does not exist.
sed: 0602-419 Cannot find or open file /home/vbsdep/upperc/ALS6_XD/CUSTOMER_INFO.tmp.
./test1.sh: line 8: 20080811/home/vbsdep/upperc/ALS6_XD/CUSTOMER_RELATIVE.tmp: A file or directory in the path name does not exist.
sed: 0602-419 Cannot find or open file /home/vbsdep/upperc/ALS6_XD/CUSTOMER_RELATIVE.tmp.
sed: 0602-419 Cannot find or open file /home/vbsdep/upperc/ALS6_XD/BUSINESS_CONTRACT.tmp.
./test1.sh: line 8: 20080811/home/vbsdep/upperc/ALS6_XD/BUSINESS_CONTRACT.tmp: A file or directory in the path name does not exist.
./test1.sh: line 8: 20080811/home/vbsdep/upperc/ALS6_XD/BUSINESS_PUTOUT.tmp: A file or directory in the path name does not exist.
sed: 0602-419 Cannot find or open file /home/vbsdep/upperc/ALS6_XD/BUSINESS_PUTOUT.tmp.
./test1.sh: line 8: 20080811/home/vbsdep/upperc/ALS6_XD/BUSINESS_DUEBILL.tmp: A file or directory in the path name does not exist.
sed: 0602-419 Cannot find or open file /home/vbsdep/upperc/ALS6_XD/BUSINESS_DUEBILL.tmp.
./test1.sh: line 8: 20080811/home/vbsdep/upperc/ALS6_XD/BUSINESS_HISTORY.tmp: A file or directory in the path name does not exist.
sed: 0602-419 Cannot find or open file /home/vbsdep/upperc/ALS6_XD/BUSINESS_HISTORY.tmp.
./test1.sh: line 8: 20080811/home/vbsdep/upperc/ALS6_XD/BUSINESS_EXTENSION.tmp: A file or directory in the path name does not exist.
sed: 0602-419 Cannot find or open file /home/vbsdep/upperc/ALS6_XD/BUSINESS_EXTENSION.tmp.
./test1.sh: line 8: 20080811/home/vbsdep/upperc/ALS6_XD/BUSINESS_WASTEBOOK.tmp: A file or directory in the path name does not exist.
sed: 0602-419 Cannot find or open file /home/vbsdep/upperc/ALS6_XD/BUSINESS_WASTEBOOK.tmp.
./test1.sh: line 8: 20080811/home/vbsdep/upperc/ALS6_XD/CLASSIFY_RECORD.tmp: A file or directory in the path name does not exist.
sed: 0602-419 Cannot find or open file /home/vbsdep/upperc/ALS6_XD/CLASSIFY_RECORD.tmp.
sed: 0602-419 Cannot find or open file /home/vbsdep/upperc/ALS6_XD/LOANBACKSTATUS.tmp.
./test1.sh: line 8: 20080811/home/vbsdep/upperc/ALS6_XD/LOANBACKSTATUS.tmp: A file or directory in the path name does not exist.
./test1.sh: line 8: 20080811/home/vbsdep/upperc/ALS6_XD/BUSINESS_TYPE.tmp: A file or directory in the path name does not exist.
sed: 0602-419 Cannot find or open file /home/vbsdep/upperc/ALS6_XD/BUSINESS_TYPE.tmp.
./test1.sh: line 8: 20080811/home/vbsdep/upperc/ALS6_XD/PRODUCT_DEF.tmp: A file or directory in the path name does not exist.
sed: 0602-419 Cannot find or open file /home/vbsdep/upperc/ALS6_XD/PRODUCT_DEF.tmp.
./test1.sh: line 8: 20080811/home/vbsdep/upperc/ALS6_XD/CL_TYPE.tmp: A file or directory in the path name does not exist.
sed: 0602-419 Cannot find or open file /home/vbsdep/upperc/ALS6_XD/CL_TYPE.tmp.
./test1.sh: line 8: 20080811/home/vbsdep/upperc/ALS6_XD/CL_INFO.tmp: A file or directory in the path name does not exist.
sed: 0602-419 Cannot find or open file /home/vbsdep/upperc/ALS6_XD/CL_INFO.tmp.
rm: /home/vbsdep/upperc/ALS6_XD/CL_INFO.tmp: A file or directory in the path name does not exist.
?Invalid command
Not connected.
Not connected.
Interactive mode off.
Not connected.

帮忙看看,谢谢 !!!

论坛徽章:
5
2015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:50:282015年亚洲杯之朝鲜
日期:2015-03-13 22:47:33IT运维版块每日发帖之星
日期:2016-01-09 06:20:00IT运维版块每周发帖之星
日期:2016-03-07 16:27:44
2 [报告]
发表于 2008-08-11 16:30 |只看该作者

回复 #1 upperc 的帖子

不存在路径20080811/home/vbsdep/upperc/ALS6_XD/啊

论坛徽章:
0
3 [报告]
发表于 2008-08-11 16:31 |只看该作者
恩,怎么会存在这样的一个路径啊?

奇怪了。。。。

论坛徽章:
5
2015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:50:282015年亚洲杯之朝鲜
日期:2015-03-13 22:47:33IT运维版块每日发帖之星
日期:2016-01-09 06:20:00IT运维版块每周发帖之星
日期:2016-03-07 16:27:44
4 [报告]
发表于 2008-08-11 16:33 |只看该作者
原帖由 upperc 于 2008-8-11 16:31 发表
恩,怎么会存在这样的一个路径啊?

奇怪了。。。。

有什么好奇怪的,$cdate$file就产生这样的路径了。

论坛徽章:
0
5 [报告]
发表于 2008-08-11 16:35 |只看该作者
我想读取scroollist.sh 这个文本,循环执行scroollist.sh 这里面的表名。

可能实现吗?黑哥 !

论坛徽章:
5
2015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:50:282015年亚洲杯之朝鲜
日期:2015-03-13 22:47:33IT运维版块每日发帖之星
日期:2016-01-09 06:20:00IT运维版块每周发帖之星
日期:2016-03-07 16:27:44
6 [报告]
发表于 2008-08-11 16:38 |只看该作者
原帖由 upperc 于 2008-8-11 16:35 发表
我想读取scroollist.sh 这个文本,循环执行scroollist.sh 这里面的表名。

可能实现吗?黑哥 !

搞不清楚你要干什么, scroollist.sh里面的内容是什么?
每行表示一个文件名吗?

[ 本帖最后由 blackold 于 2008-8-11 16:39 编辑 ]

论坛徽章:
0
7 [报告]
发表于 2008-08-11 16:43 |只看该作者
scroollist.sh下的数据:
IND_INFO
ENT_INFO
CUSTOMER_INFO
CUSTOMER_RELATIVE
BUSINESS_CONTRACT
BUSINESS_PUTOUT
BUSINESS_DUEBILL
BUSINESS_HISTORY
BUSINESS_EXTENSION
BUSINESS_WASTEBOOK
CLASSIFY_RECORD
LOANBACKSTATUS
BUSINESS_TYPE
PRODUCT_DEF
CL_TYPE
CL_INFO
----------------------------------------
这些表名都是文本,FTP到AIX下,然后test1.sh 执行表名对应的.txt文件。。。。
明白意思了吗?

论坛徽章:
5
2015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:50:282015年亚洲杯之朝鲜
日期:2015-03-13 22:47:33IT运维版块每日发帖之星
日期:2016-01-09 06:20:00IT运维版块每周发帖之星
日期:2016-03-07 16:27:44
8 [报告]
发表于 2008-08-11 16:45 |只看该作者

回复 #7 upperc 的帖子

我来猜你的意思吧,与IND_INFO对应的是IND_INFO.txt文件,你想处理这个IND_INFO.txt文件?

论坛徽章:
0
9 [报告]
发表于 2008-08-11 16:55 |只看该作者
黑哥说的对 !

论坛徽章:
0
10 [报告]
发表于 2008-08-12 10:41 |只看该作者
原帖由 upperc 于 2008-8-11 16:25 发表
sed -f scr.sed $file | awk 'BEGIN{ FS = "\""; OFS = ""}{for(i=1;i<=NF;i++) if ( i%2) gsub(/,/,"|",$i); print}' > $cdate$file

这个有问题,你把$cdata$file 换成$file$cdate看看
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP