I have a String like this
this_is_test_string1_22 this_is_also_test_string12_6
I wanted to split and extracts string around the last unders
Using awk:
awk
$ awk 'BEGIN{FS=OFS="_"}{last=$NF;NF--;print $0" "last}' < this_is_test_string1_22 > this_is_also_test_string12_6 > EOF this_is_test_string1 22 this_is_also_test_string12 6