Wednesday, May 25, 2016

AWk example


#!/bin/bash

F="file.txt"
F2="file2.txt"
rm -f $F2
touch $F2

S=""

for i in $(cat $F)
do
        S=`echo $i | awk -F"_" 'BEGIN{ st="" }
                             { for( i=1; i<=NF; i++ )
                                { st=st""toupper(substr($i,1,1)) }
                             }
                             END{ print st }'`
        echo $i","$S >> $F2

done

No comments:

Post a Comment