Is there any way to print all the string till we get a space and a number and store it a variable
for eg we have string java.io.IOException: An existing connection was forcibly closed by the remote host 12
All I want is to store "java.io.IOException: An existing connection was forcibly closed by the remote host" in a variable and "12" in another variable.
Plz give the solution with for loop, as I have lot of string like this.Plz help me on this.
Note: end of the string or seperation point is "space and a number".
Table generation time : 0.61 ms
Cube clean time : 1.93 ms
i=0,the logic that I applied was store this o/p in a single variable called "col".
then col [i]=0 and col[i\+1]=892 so on and increment i with 2.
But the problem I found was with
DoExpressCheckout Payment
2.NVPPAYMENTSERV INTERNAL 0(10002) 1
2.NVPPAYMENTSERV INTERNAL.5005 1
as I wanted "DoExpressCheckout Payment" to be assigned to col [i]but instead "DoExpressCheckout" was assigned and the "Payment" was treated as a seperate variable.But I want this not happen.
I want the o/p to be parsed and when a condition like "space + number" is met then store that entire string to a variable.
cat file_having_java_strings | while read str
do
var1=${str##* } #will contain number part of the error string
var2=${str% *} # will contain the text part of the error string
echo "$var1"
echo "$var2"
done