I have a sample file which looks like
emp_id(int),name(string),age(int)
1,hasa,34
2,dafa,45
3,fasa,12
8f,123Rag,12
8,fafl,12
Requirement: Column data types are specified as strings and integers. Emp_id should be a integer not string. these conditions ll be the same for name and age columns.
My output should look like#
Actual column Emp_id type is INT but string was found at the position 4, value is 8f
Actual column name type is STRING but numbers were found at the position 4, value is 123Rag
continues..
here is my code Shell script
read input
if [ $input -eq $input 2>/dev/null ]
then
echo "$input is an integer"
else
echo "$input is not an integer"
fi
In python, i was trying with Isinstance(obj,type) but it is not serving the purpose. can any guide me in this regard, Any shell/python/perl script help would be appreciated!