Newbie UNIX user question ...
The input file (location.txt
) is this:
WGS_LAT deg 12
WGS_LAT min 30
WGS_LAT sec 05
WGS_LAT hsec 29
WGS_LAT northSouth North
WGS_DLAT decimalDegreesLatitude 12.501469
WGS_LONG deg 07
WGS_LONG min 00
WGS_LONG sec 05
WGS_LONG hsec 61
WGS_LONG eastWest West
WGS_DLONG decimalDegreesLongitude -70.015606
I want to get all lines that start with WGS_LAT
or WGS_DLAT
.
First, is grep
the tool you recommend for this job?
Second, if it is, then how to express the pattern? All of these failed:
grep ^WGS_LAT|^WGS_DLAT location.txt
grep ^(WGS_LAT|WGS_DLAT) location.txt
grep ^WGS_D?LAT location.txt
What is the correct pattern, please?