Jun 8, 2005 #1 cptk Technical User Mar 18, 2003 305 US Say I have .... 423045.000N and I want to find the "." and delete the rest of the word. example: cat 423045.000N | awk '{gsub(/\.+/,""); print}' gives me --> 423045000N but I want --> 423045
Say I have .... 423045.000N and I want to find the "." and delete the rest of the word. example: cat 423045.000N | awk '{gsub(/\.+/,""); print}' gives me --> 423045000N but I want --> 423045
Jun 8, 2005 1 #2 PHV MIS Nov 8, 2002 53,708 FR awk '{for(i=1;i<=NF;++i) sub(/\..*/,"",$i); print}' Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886 Upvote 0 Downvote
awk '{for(i=1;i<=NF;++i) sub(/\..*/,"",$i); print}' Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
Jun 8, 2005 Thread starter #3 cptk Technical User Mar 18, 2003 305 US ...perfect !!! Upvote 0 Downvote
Jun 8, 2005 Thread starter #4 cptk Technical User Mar 18, 2003 305 US ...oh, but I have a slight wrinkle ... same problem, but now I have multiple words that I have to run this though ... I have ... 423045.000N 0772345.000N I want ... 423045 0772345 Upvote 0 Downvote
...oh, but I have a slight wrinkle ... same problem, but now I have multiple words that I have to run this though ... I have ... 423045.000N 0772345.000N I want ... 423045 0772345
Jun 8, 2005 #5 PHV MIS Nov 8, 2002 53,708 FR Works for me: echo 423045.000N 0772345.000N | awk '{for(i=1;i<=NF;++i)sub(/\..*/,"",$i); print}' 423045 0772345 Upvote 0 Downvote
Works for me: echo 423045.000N 0772345.000N | awk '{for(i=1;i<=NF;++i)sub(/\..*/,"",$i); print}' 423045 0772345
Jun 9, 2005 Thread starter #6 cptk Technical User Mar 18, 2003 305 US ...and it does for me now (my mistake)!!! Thanks PHV !!! Upvote 0 Downvote