ChinaUnix.net
相关文章推荐:

shell 将字符串按照指定字符分割为数组

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

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

相关讨论

shell会自动赋值给变量的字符中的换行变为空白么? 比如这样: [code]var='abcdefg >hij'[/code] 此时echo $var,得到的结果是: [code]abcdefg hij[/code] 而不是想象中的abcdefg和hij在两行,也就是shell好像把换行符替换成了空白。 有没有办法阻止这种转换?或者有什么办法能在赋值给变量的字符中加入一个换行?

by Maxshine - Shell - 2009-08-21 17:03:21 阅读(4651) 回复(3)

:cry: 现在有数十个文本文件,我想其中的一个字符全部替换成另外的字符, 一个一个文件去vi的话,太麻烦了,能不能用一个shell一下子把所有的文件全部处理了.

by galaxy1975 - Shell - 2008-01-21 11:01:29 阅读(16840) 回复(23)
by todayhero - Shell - 2009-01-19 22:16:43 阅读(2483) 回复(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 阅读(6626) 回复(8)

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

by qwldcl - Shell - 2008-05-19 13:35:25 阅读(3495) 回复(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 阅读(1562) 回复(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 阅读(1114) 回复(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 阅读(1820) 回复(16)
by agui1226 - Shell - 2006-07-05 14:17:03 阅读(5570) 回复(4)

文件 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 阅读(1603) 回复(7)