本人对shell脚本刚刚接触,请大家指教,见笑了. 用ftp当天备份数据,我想通过比对文件时间并以星期分类存放数据 我想到的方法: cd /ftp ls -la |grep nfsdir |awk '{print $6"\t"$7}' echo `date` | awk '{print $2"\t"$3}' 这两个输出将列出月份和日期,我想对两个结果做个比对,如果相等,则执行cpoy,这个怎么写?能完成以星期分类存放么? [ 本帖最后由 jat_15 于 2009-2-25 11:17 编辑 ]
看了前面的一篇关于从文件读取一行到变量中想到的一个问题。 在文件中a.file的内容如下: /dev/device1 abc /dev/device2 def /dev/device3 abc /dev/device11 dfe 这种情况下,中间有空行。我想从文件a.file中读到每一行的devicex,然后保存到变量中。使用循环的方式。每次读一行,读到之后,就将devicex的值(就是device(1-3))保存到变量var中,然后就是对var这个变量中的值devicex进...
在文件table.list中有如下内容, cat table.list ./tempdata/s_job_chain.txt ./tempdata/s_entity_info.txt ./tempdata/s_db_info.txt ./tempdata/s_job_cost.txt ./tempdata/s_datamng_log.txt ./tempdata/s_audit_rule.txt ./tempdata/s_cnode_stat.txt ./tempdata/s_instance_stat.txt ./tempdata/h_instance_info.txt ./tempdata/s_ds_jobparam.txt ./tempdata/s_job_attr.txt ./tempdata/h_job_info.txt ./tempdata/s_refer_...
关于shell中的字符串。 比如 #test="abc def" 现在要得到"abc"怎么做呢? #echo ${test%% *} abc 本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/17004/showart_469647.html
我的系统是redhat linux9.0 1 所有数据存放在mysql数据库中 2 把数据库中的数据变成文本数据,便于shell处理 但我现在遇到了下面的问题: 我使用了$mysql_path/mysql -u$mysql_user -p$mysql_password -e "use $mysql_database; $sql_switch"|sed 1d|sed 's/ //g'后,还会得到如下结果: 10.10.1.26 | 1 | public | Uplink_10.10.1.15| 我发现,它们之间不是空格,而是tab或是别的字符来的...