splitting a line according to the field separator as a string

Viewed 4579

I have a file as below:

10temp3
20/temp4
28 temp 5

I am using the below command for splitting the lines and get the last number in the line.

awk -F"temp" '{print $NF}' temp3

the ouput i got is :

> awk -F"temp" '{print $NF}' temp3
10temp3
20/temp4
28 temp 5

Surprisingly if i use nawk i am getting the expected output.

> nawk -F"temp" '{print $NF}' temp3
3
4
 5
> 

May i know the reason why? Is awk not supporting the string mentioned as a separator?

1 Answers
Related