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 '{if($1=="Latitude") print $6 }' | awk '{ printf("%3i %1i %8.5f\n"),substr($0,1,3),substr($0,4,5),substr($0,5,10)}'
What I wanted this to produce is to extract and output as:
-09 02 06.48241.
The above awk did not do just that ?
Any comments please
Yacob Sen
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 '{if($1=="Latitude") print $6 }' | awk '{ printf("%3i %1i %8.5f\n"),substr($0,1,3),substr($0,4,5),substr($0,5,10)}'
What I wanted this to produce is to extract and output as:
-09 02 06.48241.
The above awk did not do just that ?
Any comments please
Yacob Sen