Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

bash "read -p"

awk 'NR == FNR {
  /^[ 	]*47name/ && c++      # get the field number
  if (/^[ 	]*47size/) {
    split($0, t, ":")          
    gsub(/[ 	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
Source by www.unix.com #
 
PREVIOUS NEXT
Tagged: #bash
ADD COMMENT
Topic
Name
1+4 =