awk 'FNR==NR{a[$2]=$3;next} {print $0,a[$2]}' Input_file2 Input_file1 Input_file2 Input_file1
#!/bin/bash
IFS=" "
cat 1.txt| while read a b
do
out=`grep $b 2.txt`
sed -i "s/$b/$out/g" 1.txt
done
myvariable=$(awk -F" " ' { print "\x27""880"$1"\x27" $b }' out.txt|sed '$!s/$/,/g' | tr -d '\n'|tr -d ' ')
echo $myvariable
echo "select csub.msisdn,fm.external_id from contracts_subscription csub, fourpane_memo fm where csub.id=fm.object_id and csub.msisdn in ( $myvariable ) and fm.handler_name='sim_card'"| mysql -uusername --pPASSWORD webdb >testout.txt
#!/bin/bash
IFS=" "
cat 1.txt| while read a b
do
out=`grep $b 2.txt`
sed -i "s/$b/$out/g" 1.txt
done
myvariable=$(awk -F" " ' { print "\x27""880"$1"\x27" $b }' out.txt|sed '$!s/$/,/g' | tr -d '\n'|tr -d ' ')
echo $myvariable
echo "select csub.msisdn,fm.external_id from contracts_subscription csub, fourpane_memo fm where csub.id=fm.object_id and csub.msisdn in ( $myvariable ) and fm.handler_name='sim_card'"| mysql -uusername --pPASSWORD webdb >testout.txt
No comments:
Post a Comment