![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
shell
chenlongzhen_tech
[声明] 此账号不在更新,请关注 http://blog.csdn.net/tech_chenlongzhen
展开
-
shell 脚本学习2
交互输入自动化[cloudera@quickstart shell]$ head input.data 1 hello # shell [cloudera@quickstart shell]$ cat vim interactive.sh cat: vim: No such file or directory #!/bin/bash #Filename": interactive.sh read -转载 2015-11-16 14:30:12 · 759 阅读 · 0 评论 -
shell 脚本学习 awk
格式awk ' BEGIN{ print "start" } pattern { commands } END{ print "end" } file特殊变量[clz@localhost ~]$ echo -e "line1 f2 f3\nline2 f4 f5\nline3 f6 f7" | awk '{ print "Line no:"NR,"No of fields:"NF , "$0="$0转载 2015-11-17 13:38:15 · 467 阅读 · 0 评论 -
shell脚本学习 正则表达
正则表达式-c 计算匹配的行数 -o 只输出匹配出的字符串 -E egrep -v 打印匹配之外的行 -l 从多文件中查找 输出含有表达式的文件名字 -L 与-l相反 -n 显示匹配的所在行 -R -r递归 -i 忽略pattern中的大小写 -q 静默 若grep 匹配成功返回0 要匹配给定文本中的所有单词, 可以使用下面的正则表达式 # 单词匹配 ?表示可能出现的空格 [a-zA-Z]单词 (转载 2015-11-17 14:27:23 · 507 阅读 · 0 评论 -
shell脚本学习sed
sed-i 替换并保存 's/pattern/replace_string/' 只替换第一处 's/pattern/replace_string/g' 替换所有 's/pattern/replace_string/Ng' 从第N处开始匹配 # ex 直接替换文本 [clz@localhost shell_learn]$ sed -i 's/cecho.sh/xxxxxxxxxxxxxx/' file原创 2015-11-17 14:28:00 · 464 阅读 · 0 评论