Você pode sort
numericamente no delimitador [
:
sort -t\[ -nk2,2 <<\IN
int array[0]
int array[1001]
int array[1002]
int array[1003]
int array[2]
int array[2001]
int array[2002]
IN
OUTPUT
int array[0]
int array[2]
int array[1001]
int array[1002]
int array[1003]
int array[2001]
int array[2002]