It is necessary to track the position of the double space, so that according to it, like a marker, divide the line into two.

str="Происзвольная строка 1. Продолжение строки и так далее"; poz=`expr index "$c" " " ` ; echo $poz; str1=${c:0:poz}; echo $str1; str2=${c:poz}; echo $str2; 

Returns zero and two blank lines.

    1 answer 1

    You can use the native tools of the bash program to remove prefixes and suffixes:

     str="Произвольная строка 1. Продолжение строки и так далее" echo ${str%% *} echo ${str##* } 

    result:

     Произвольная строка 1. Продолжение строки и так далее 
    • but if you need a position, then see here - aleksandr barakin
    • ${var%%...} , ${var##...} (greedy and non-greedy options) are variants of a pure shell. bash has nothing to do with it. Read pubs.opengroup.org/onlinepubs/007904875/utilities/… - 0andriy
    • Thank. What you need. - Ilya
    • @ Ilya, mark as correct. - 0andriy