ChinaUnix.net
相关文章推荐:

shell 字符串 分割 个数

各位兄弟帮忙看看; src="test.txt" src=$src" " echo "value is ["$src"]" 结果竟然还是[test.txt] 如何增加指定个数的空格 谢谢!

by lzf - Shell - 2005-06-11 16:20:44 阅读(5476) 回复(12)

相关讨论

各位大侠,小弟有一个很棘手的问题。请各位大侠帮忙。 问题: 现在有一个复合型文件(即,文件行的字段数不等,但还是有规律),例如:文件的每行中第二个字段为1(表示有8个字段)、2(表示有10个字段)、3(表示有10个字段)。文件总是以1开始,3结束,2有可能没有,也有可能有多行,但1和3只有一行。现在想把这样的一个文件,分割到3个文件中,行中有1 的,都到文件1;行中有2的,都到文件2;行中有3的,都到文件3 。 例如...

by chen_gxing - Shell - 2005-10-25 16:36:19 阅读(4187) 回复(11)
by todayhero - Shell - 2009-01-19 22:16:43 阅读(2486) 回复(8)

在文件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_...

by legone2008 - Shell - 2008-08-29 02:18:17 阅读(6634) 回复(8)

"2008-4-2" 怎样变成 2008-4-2 也就是把分号去掉

by qwldcl - Shell - 2008-05-19 13:35:25 阅读(3501) 回复(10)

关于shell中的字符串。 比如 #test="abc def" 现在要得到"abc"怎么做呢? #echo ${test%% *} abc 本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/17004/showart_469647.html

by shiwudao - HP文档中心 - 2008-01-22 22:52:17 阅读(1565) 回复(0)

我的系统是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或是别的字符来的...

by netpat - Shell - 2005-04-01 15:25:45 阅读(1118) 回复(2)

有4个字符串,wks,adm,jm1,jm2.想用for循环来做,当 i 为wks时候做..当 i 为 adm时候做, for i in "wks" "adm" "jm1" "jm2" do ..... done 可以么 ,或用其他的方法

by zhangpiwang - Shell - 2003-10-20 23:50:28 阅读(1826) 回复(16)

文件 init.xml 0 0 0 0 0 脚本: #!/bin/sh ipfile="init.xml" tcp=`grep tcp $ipfile |sed -e "s@@@" -e "s@@@"` udp=`grep udp $ipfile |sed -e "s@@@" -e "s@@@"` tns=`grep tns $ipfile |sed -e "s@@@" -e "s@@@"` ftp=`grep ftp $ipfile |sed -e "s@@@" -e "s@@@"` socks=`grep socks $ip...

by starxing - Shell - 2009-07-22 15:58:41 阅读(1605) 回复(7)

如何写搜索字符串高的效率: exp: file1 : 2W 条记录,每条记录为长度不一的单一字符串,15~20字符.文件共1MB file2 : 50W条记录,每条记录为多个字符串,长度800~1000字符.文件共500MB 如何以file1中字符串为关键字,在file2中找出这些记录? 现在能实现这样的功能,但效率太低,执行的时间太长,各位能否给个高效的实现方法?

by yyt030 - Shell - 2009-07-11 00:01:54 阅读(1900) 回复(4)

各位大侠好!小弟初学shell,现在想要从当日的日志中过滤出访问量大于10000的ip地址,然后把这些ip地址同ip.txt中的地址做比较,如果该ip不在ip.txt列表中则打印这些ip到文本文件result.txt中,我是这样写的,但是不能实现,请大家帮忙看看怎么写简单能实现功能,谢谢! #!/bin/bash i=$(echo "ex'date+%y%m%d'.log'") j=$(awk '{print $11}' ../../$i |sort |uniq -c |sort -k1 -n -r|awk '{if($1>5000) print $2 "\r"}') while r...

by 爱斯基摩寂寞 - Shell - 2009-06-16 15:59:33 阅读(2722) 回复(4)