shell中awk分割字符:
F后面为分割符号
name=`echo "my name is Eric"|awk -F ' ' '{print $4}'`
Example:
#!/bin/bash
total=0
for i in `ls *.json`
do
num=`wc -l $i | awk -F ' ' '{print $1}'`
let total=$total+$num
echo $total
done;
原文链接:https://www.f2er.com/bash/390509.html