Errata to the question
sorry I meant
cat test.dat | awk '{if($1=="Latitude") print $6 }' | awk '{ printf("%3i %2i %8.5f\n"),substr($0,1,3),substr($0,4,2),substr($0,6,5)}'
it produces: 9 2 6.48000
This misses the "-" and as well as the zeros. I wanted it to produce:
-09 02 06.48000...
Dear ALL,
I want to extract a string from a file and using the substr function to extract substrings from a string.
I have a file name say "test.dat"
cat test.dat | awk '{if($1=="Latitude") print $6 }'
this produce say "-090206.48241"
the I pipe this directly to
cat test.dat | awk...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.