1、 用 sed 修改 test
txt 的 23 行 test 为 tset; sed –i ‘23s/test/tset/g’ test
txt2、 查看/web
log 第 25 行第三列的内容
sed –n ‘25p’ /web
log | cut –d “ ” –f3 head –n25 /web
log | tail –n1 | cut –d “ ” –f3 awk –F “ ” ‘NR==23{print $3}’ /web
log3、 删除每个临时文献的最初三行
sed –i ‘1,3d’ /tmp/*
tmp4、 脚本编程:求 100 内的质数
/bin/bash i=1 while [ $i -le 100 ];do ret=1 for (( j=2;j> /etc/crontab6、 编写个 shell 脚本将目前目录下不小于 10K 的文献转移到/tmp 目录下 #
/bin/bash fileinfo=($(du
/*)) length=${#fileinfo[@]} for((i=0;i56789){print $0}}' file
txt2) 显示 file
txt 的 1,3,5,7,10,15 行
sed -n "1p;3p;5p;7p;10p;15p" file
txt awk 'NR==1||NR==3||NR==5||…||NR=15{print $0}' file
txt3) 将