n***@gmail.com
2016-02-02 17:19:50 UTC
So I have a file with the following:
test.txt:
first1.mid1.last1
first2.last2
I'd like to convert it as follows:
first1.last1 first1 mid1 last1
first2.last2 first2 last2
However this is failing...
awk '{$1=$1" " sub(/\./," ",$1)}{ print }' test.txt > test2.txt
I guess it's replacing the $1 field altogether... is there a way I can do this in another method?
test.txt:
first1.mid1.last1
first2.last2
I'd like to convert it as follows:
first1.last1 first1 mid1 last1
first2.last2 first2 last2
However this is failing...
awk '{$1=$1" " sub(/\./," ",$1)}{ print }' test.txt > test2.txt
I guess it's replacing the $1 field altogether... is there a way I can do this in another method?