码迷,mamicode.com
首页 > 系统相关 > 详细

15-Linux不会别做运维-find与sed

时间:2019-12-05 22:40:19      阅读:147      评论:0      收藏:0      [点我收藏+]

标签:生成   注释   manager   运维   inux   数据   gre   管理   标准   

其它特殊字符:
; 命令结尾
‘# 注释 管理员提示符
$ 调用变量 普通用户提示符
\ 转义字符 取消别名
{ } 生成序列 分割变量和变通字符
& 执行脚本时候把脚本放入后台

find . -type f -name "[abcd]" |grep "a"

重定向系统:
0 标准输入
1 标准输出
2 错误输出

箭头方向是数据流向;

‘ > 和 1> 输出重定向,内容追加到结尾
2> 错误输出重定向,清空内容

’ >> 1>> 追加输出重定向,内容追加到结尾
2>> 错误追加输出重定向,内容追加到结尾

以下3种用法是等价的:
echo "111" 1>>exam.txt 2>>feiliu.txt
echo "111" 1>>exam.txt 2>&1 第二种方法
echo "111" &>>exam.txt

echo "111" 2>>exam.txt 1>&2

<或0< 标准输入重定向
<< 或0<<

cat >>exam.txt<<EOF
d tve qy tve qy c ue
e g ywwf mm
mmm jfd e wh w
EOF

ls |xargs rm -f 相当于: rm -f a b c

[root@manager ~/exam]$ touch a b c 
[root@manager ~/exam]$ ll
total 0
-rw-r--r--. 1 root root 0 Dec  5 18:57 a
-rw-r--r--. 1 root root 0 Dec  5 18:57 b
-rw-r--r--. 1 root root 0 Dec  5 18:57 c
[root@manager ~/exam]$ ls |xargs rm -f
[root@manager ~/exam]$ ll
total 0
find /exam/  -type f -name "[1-9]"|xargs rm -f 
原理:  rm -f 1 2 3

15-Linux不会别做运维-find与sed

标签:生成   注释   manager   运维   inux   数据   gre   管理   标准   

原文地址:https://blog.51cto.com/1674389/2456469

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!