shell分割字符

前端之家收集整理的这篇文章主要介绍了shell分割字符前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

shell中awk分割字符:
F后面为分割符号

  1. name=`echo "my name is Eric"|awk -F ' ' '{print $4}'`

Example:

  1. #!/bin/bash
  2. total=0
  3. for i in `ls *.json`
  4. do
  5. num=`wc -l $i | awk -F ' ' '{print $1}'`
  6. let total=$total+$num
  7. echo $total
  8. done;

猜你在找的Bash相关文章