I need to read the value of a parameter in a file. If the number of characters in this value is more than 10 then I need to take the first 10 characters of this value(something like a substring(value,1,10)) and substitute it as its value.
e.g.,
TABLENAME=EMPLOYEE_RECORD - Here the value of TABLENAME(i.e., EMPLOYEE_RECORD) contains 15 characters, hence we need to change the value of TABLE to the first 10 characters. Hence the value will become TABLENAME=EMPLOYEE_R.
If the number of characters in the value for this variable it 10 or less, then we need to leave it alone.
e.g.,
TABLENAME=DEPARTMENT
then
TABLENAME=DEPARTMENT
I would appreciate if someone could tell me how to do this in a shell script.
Thanks,
P
e.g.,
TABLENAME=EMPLOYEE_RECORD - Here the value of TABLENAME(i.e., EMPLOYEE_RECORD) contains 15 characters, hence we need to change the value of TABLE to the first 10 characters. Hence the value will become TABLENAME=EMPLOYEE_R.
If the number of characters in the value for this variable it 10 or less, then we need to leave it alone.
e.g.,
TABLENAME=DEPARTMENT
then
TABLENAME=DEPARTMENT
I would appreciate if someone could tell me how to do this in a shell script.
Thanks,
P