I am trying to use the gpspipe tool to create a file output of latitude and longitude data from a usb receiver I have plugged in. All I am interested in is the latitude and longitude (and potentially speed), so I have constructed the current line of code isolating the GPPA lines (which have this info).
gpspipe -r -t -o test.txt | grep GPPA
However this just writes all the NMEA data directly to the file skipping the grep command, I assume this is as the -o is presented first, however neither of the following lines work either.
gpspipe -r -t | grep GPPA | gpspipe -o test.txt
gpspipe -r -t | grep GPPA | > test.txt
The former fails to run and the latter writes a blank file, this is the first real project I am undertaking using linux so am a little unsure on command construction, is it possible to get the output I want i.e. a line by line .txt file of only the GPPA lines?
You almost got the solution:
Obviously, this only works when this command gives you the results you're looking for:
If not, just launch
gpspipe -r -tand check for the presence ofGPPAin the results. When you're dealing with capitals and small letters, you might usegrep -i "GPPA"for working in a case insensitive way.In case you have issues with file permissions, you might make sure the file exists and then launch the following command:
2>&1makes sure that ALL output (normal output and error output) is redirected to the output file.>>adds the information to the already existing file.