![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Shell
文章平均质量分 51
feverforce
这个作者很懒,什么都没留下…
展开
-
grep/sed 匹配变量
<br />一定要用 ‘ ’将命令与变量分离,嗯<br />grep -w ''${names[$i]}'$' filename原创 2010-12-08 18:53:00 · 4318 阅读 · 0 评论 -
linux下用命令批量修改替换文件内容
在linux入侵之后,我们要清除留下的一些痕迹,比如apache留下的日志.但是对于ssh登陆日志比如/var/log/wtmp 和 lastlog这类二进制文件,sed命令就爱莫能助了.Linux下批量替换多个文件中的字符串的简单方法。用sed命令可以批量替换多个文件中的字符串。用sed命令可以批量替换多个文件中的字符串。sed -i "s/原字符串/新字符串/g" `grep 原字符串 -rl 所在目录`(千万注意这个符号,是最左上角那个符号不是单引号)例如:我要把/test下所有包含a转载 2011-04-11 15:42:00 · 4174 阅读 · 1 评论 -
sed和awk中使用shell变量
转载自 jrckkyy最终编辑 zengzhaonongsed和awk中使用shell变量----------------------------------------------x=MMsed 's/AB/'$x'/g' b.c或sed 's/AB/'"$x"'/g' b.csed 's/'"$val"'//' urfile最近做预料处理,使用bash脚本,需要在脚本的sed和awk使用shell变量以控制循环,出现一些问题后找到解决办法如下:1.sed使用she转载 2011-04-11 15:47:00 · 5421 阅读 · 0 评论 -
脚本备份
#!/bin/bashid | grep root >/dev/nullif [ $? != 0 ]; then disk_spare=`df -h | grep export | awk -F'[ ]+|%' '{print $4}'` df=`df -h | grep export | awk -F'[ ]+|%' '{print $5}'` if [ $df -gt 95 ]; then echo -e "原创 2011-05-05 15:36:00 · 471 阅读 · 0 评论 -
Comparison operator in shell
http://www.unix.com/shell-programming-scripting/120511-if-clause-problem-err-integer-expression-expected.html<br />A binary comparison operator compares two variables or quantities. Note that integer and string comparisonuse a different set of operator转载 2011-05-11 14:59:00 · 618 阅读 · 0 评论