awk, sed, xargs, bash

http://ryanstutorials.net/
 
awk:
split($1, arr, “\t”)
awk '{BEGIN{FS="\x01"} {print $2}'
 
sed:
sed -n '42p' file
sed -n '1,2p' file
sed '42d' file
sed 's/replace_pattern/replace_str/g' file
sed '/remove_pattern/d' file
sed -i [operation] 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.
 
posted on 2019-02-11 21:14  冰山上的博客  阅读(268)  评论(0编辑  收藏  举报