Problem :
I want to create a separate file for country list if condition is true. Please help.
Input file:
SV-INCR-139302-365540488-201104090934.sqllog
SV-INCR-1082-552793184-201104040805.sqllog
SV-INCR-1077-855045741-201104040805.sqllog
SV-INCR-994-386000426-201104080808.sqllog
*****************************************************
Script :
#!/bin/ksh
# with the help of awk command we are taking third value.
awk -F'-' '{print $3}' input|while read third; do
# checking if country code is 139302
if [ $third -eq 139302 ] || [ $third -eq 994 ]; then
echo $third
fi
done
output country list file:
SV-INCR-139302-365540488-201104090934.sqllog
SV-INCR-994-386000426-201104080808.sqllog