Shell
文章平均质量分 51
feverforce
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
grep/sed 匹配变量
<br />一定要用 ‘ ’将命令与变量分离,嗯<br />grep -w ''${names[$i]}'$' filename原创 2010-12-08 18:53:00 · 4401 阅读 · 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 · 4351 阅读 · 1 评论 -
sed和awk中使用shell变量
转载自 jrckkyy最终编辑 zengzhaonong sed和awk中使用shell变量 ---------------------------------------------- x=MM sed 's/AB/'$x'/g' b.c 或 sed 's/AB/'"$x"'/g' b.c sed 's/'"$val"'//' urfile 最近做预料处理,使用bash脚本,需要在脚本的sed和awk使用shell变量以控制循环,出现一些问题后找到解决办法如下: 1.sed使用she转载 2011-04-11 15:47:00 · 5495 阅读 · 0 评论 -
脚本备份
#!/bin/bash id | grep root >/dev/null if [ $? != 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 · 522 阅读 · 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 comparison use a different set of operator转载 2011-05-11 14:59:00 · 679 阅读 · 0 评论
分享