📌  相关文章
📜  bash "read -p" - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:50:19.504000             🧑  作者: Mango

代码示例3
awk 'NR == FNR {
  /^[ \t]*\47name/ && c++      # get the field number
  if (/^[ \t]*\47size/) {
    split($0, t, ":")          
    gsub(/[ \t\47,]/, x, t[2]) # strip punctuation
    fmt[c] = t[2]              # get the size 
    }
  next                         # run the above actions                                     
  }                            # + only for the first input file
{ 
  for (i=1; i<=NF; i++)        # output the strings in the correct format
    printf "%" (length($i) > fmt[i] ? "." : "-" ) fmt[i] "s", $i           
  print x
  }' config.txt temp.txt