Chinaunix首页 | 论坛 | 博客
  • 博客访问: 444550
  • 博文数量: 293
  • 博客积分: 4204
  • 博客等级: 上校
  • 技术积分: 3060
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-21 10:27
个人简介

nobody

文章分类

全部博文(293)

文章存档

2014年(27)

2013年(105)

2012年(41)

2011年(109)

2010年(11)

分类:

2011-02-27 12:39:54

1  修改后缀(manipulating strings)
find . -name '*.sh' | while read org;do new=${org/%sh/shell}; mv $org $new ;done

2  awk format
awk '{printf "%15s\n",$1}'   hello.txt

test文件中在每行前后各插入一个空白行
sed -e 'a\\' -e 'i\\' test

4 删除空行
$ sed '/^$/d;G' file

5 删除名字不为xxx的文件
 find ./ ! -name "*._raw_*" -exec rm -fr {} \;

6 删除指定行 
sed -i '/abc sa/!d'  file

7 date 
date  -d"11 days ago" +%Y-%m-%d

8 grep filter from file 
grep -f filter_file input_file

9 kill job
jobs
kill %$(Job_Nr)

10 vim 删除文件内容
:1,$d

11 ls  --time-style选项
ls -l --time-style=+%s


12
grep -l "abcd" `find /root/doc/ -maxdepth 1 -name test* -print`|wc -l

13
 


a=ab_cd/ef
b=${a#*_}
c=${b%\/*}
echo $

14
for ((i=1;i<5;i++));do echo $i;done

15
chown root a
chmod 4770 a
这样任何一个用户执行a的时候,都是root用户的权限
阅读(1230) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~