i want to extract all except "AUTO_INCREMENT" not only this line i ,want the code to work on any line if it has AUTO_INCREMENT... i can do this using string manipulation like
len=${#line1}
char=${line1:$len-1:$len}
if [ "$char" = "," ]
then
line11=${line1:0:$len-15}
else
line11=${line1:0:$len-14}
fi
but this is lengthy so is there any one liners to do the above function.... :-/
the above lines are in a file...
i will be reading them in a while loop.. so it will be stored in a variable called $line
in the above condition it is 'empno' but lets say we have
id` int(11) NOT NULL DEFAULT '0' AUTO_INCREMENT
since the while loop is dynamic it should work for all formats...
---------- Post updated at 12:27 PM ---------- Previous update was at 12:17 PM ----------
i have one more doubt.. say i have some contents in two variables
$aaa and $bbb.... say $aaa has "vivek" and $bbb has "ViVeK"
so if i perform below..
if [ "$aaa" = "$bbb" ]
it satisfies only if case is same... is there anyway i could compare case insesitively..?
where is the input variable in the above line..? if the input line is stored in a variable called $line how to use it in the above statement... and also i want the output to be stored in another variable say $modified...
and also how to compare variables with case insensitive as i asked previously..?