awk, sed, xargs, bash

Posted yaoyaohust

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了awk, sed, xargs, bash相关的知识,希望对你有一定的参考价值。

 
awk:
split($1, arr, “ ”)
 
sed:
sed -n ‘42p‘ file
sed ‘42d‘ file
sed ‘s/replace_pattern/replace_str/g‘ file
sed ‘/remove_pattern/d‘ file
sed -i file #(inplace)直接修改读取的文件内容,而不是输出到终端
 
xargs:
xargs -n1 -i cmd {} 
 
bash:
  • $HOSTNAME - The hostname of the machine the script is running on.
  • Single quotes will treat every character literally.
  • Double quotes will allow you to do substitution (that is include variables within the setting of the value).
  • read varNameRead input from the user and store it in the variable varName./dev/stdinA file you can read to get the STDIN for the Bash script
  • $(( expression ))  Return the result of the expression.${#var}Return the length of the variable var.
 

以上是关于awk, sed, xargs, bash的主要内容,如果未能解决你的问题,请参考以下文章

sed后向引用取行及awk取列

linux 文本内容替换(awk/sed)

Linux命令之grep/sed/awk等行转列

linux awk命令详解

find cat sed awk 简单组合使用

linux下查找文件及文件内查找内容--find/grep/sed/awk