I have a lot of file with a lot of lines following the same pattern
the lines go like this:
alpha_9/output- -413.74928476 2.6116
and I want it to be:
9 -413.74928476 2.6116
thanks for the help
I have a lot of file with a lot of lines following the same pattern
the lines go like this:
alpha_9/output- -413.74928476 2.6116
and I want it to be:
9 -413.74928476 2.6116
thanks for the help
Hi, try:
awk '{split($1,F,"[_/]"); $1=F[2]}1' file
It worked 
tyvm
Try also
awk 'gsub (/[^0-9]/, "", $1)' file
working as well
thanks
Can u explain the different so I can choose the better one for me?
One splits the first field's contents at _ and / and prints the second element of the result. The other removes all non-digit characters and assumes there are such so gsub 's return value is non-zero (= TRUE) so it does the default action: print .