Sponsored Content
Top Forums Shell Programming and Scripting shell script to read a line in gps receiver log file and append that line to new file Post 302328131 by gudivada213 on Tuesday 23rd of June 2009 12:33:26 PM
Old 06-23-2009
shell script to read a line in gps receiver log file and append that line to new file

Hi,

I have gps receiver log..its giving readings .like below

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GPSD,R=1
$GPGSV,3,1,11,08,16,328,40,11,36,127,00,28,33,283,39,20,11,165,00*71
$GPGSV,3,2,11,17,24,208,39,27,11,097,00,13,87,174,00,19,31,042,00*70
$GPGSV,3,3,11,25,43,033,38,03,07,037,00,23,47,150,00*44
$GPGGA,111503,0833.6323,N,07652.7685,E,1,04,1.60,16.69,M,-94.088,M,,*58
$GPRMC,111503,A,0833.6323,N,07652.7685,E,0.1866,256.540,220609,,*2A
$GPGSA,A,3,08,28,17,25,,,,,,,,,0.0,1.6,16.3*02
$GPGGA,111504,0833.6316,N,07652.7682,E,1,04,1.60,18.70,M,-94.088,M,,*58
$GPRMC,111504,A,0833.6316,N,07652.7682,E,0.1866,256.540,220609,,*2C
$GPGSA,A,3,08,28,17,25,,,,,,,,,0.0,1.6,16.3*02
$PGRME,0.00,M,0.00,M,0.00,M*1E
$GPGGA,111505,0833.6328,N,07652.7684,E,1,04,1.60,25.15,M,-94.088,M,,*5F
$GPRMC,111505,A,0833.6328,N,07652.7684,E,0.1488,238.090,220609,,*2A
$GPGSA,A,3,08,28,17,25,,,,,,,,,0.0,1.6,16.3*02
$GPGGA,111506,0833.6336,N,07652.7654,E,1,04,1.60,27.75,M,-94.088,M,,*5A
$GPRMC,111506,A,0833.6336,N,07652.7654,E,0.1866,256.540,220609,,*27
$GPGSA,A,3,08,28,17,25,,,,,,,,,0.0,1.6,16.3*02
$PGRME,0.00,M,0.00,M,0.00,M*1E
$GPGGA,111507,0833.6341,N,07652.7644,E,1,04,1.60,29.31,M,-94.088,M,,*54
$GPRMC,111507,A,0833.6341,N,07652.7644,E,0.1866,256.540,220609,,*27
$GPGSA,A,3,08,28,17,25,,,,,,,,,0.0,1.6,16.3*02
-
-
--
--
what i need?
Shell script has to check for each log line starting word with "$GPRMC", if line starts with $GPRMC, then that line has to append a new file data.txt

For example:

when i started the gps receiver log is giving
first line: Trying 127.0.0.1... has to check whether it is started with $GPRMC
then when the second line came log again has to check..like...up to terminating the log.
this process has to start when the log started...

if the line starts with $GPRMC the line has to append new line...


I posted one questions,
https://www.unix.com/shell-programmin...-database.html
That is whole process i need, i think i couldnt express clearely thats why i changed title and tried to explain what i need...
i am really strucked here and this is part of my academic project..please help me.

sorry for posting two times...
thanks in advance,

sravan
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

shell script to read file line by line

Hi, I need to read a text file from shell script line by line and copy the feilds of each line. Below is the complete requirement. I've text file which contains ... pgm1 file11 file12 file13 pgm2 file21 file22 pgm3 file31 file32 file33 I'll give input as... (4 Replies)
Discussion started by: ani12345
4 Replies

2. Shell Programming and Scripting

How to append value at first line of CSV file using shell script?

I have an issue where I need to append a value at the last of the csv, I have created a shell script and it is appending the columns at the last but it is appending at all lines, and my requirement is specific to just append at the 1st line. Have a look and suggest, (7 Replies)
Discussion started by: anujrichhariya
7 Replies

3. Shell Programming and Scripting

how can u read a file line by line in shell script ?

hello , plz help for below script req:- how can we read a file line by line in shell script ? (4 Replies)
Discussion started by: abhigrkist
4 Replies

4. Shell Programming and Scripting

help needed with shell script to append to the end of a specific line in a file on multiple servers

Hi Folks, I was given a task to append three IP's at the end of a specific (and unique) line within a file on multiple servers. I was not able to do that with the help of a script. All I could was: for i in server1 server2 server3 server4 do ssh $i done I know 'sed' could be used to... (5 Replies)
Discussion started by: momin
5 Replies

5. Shell Programming and Scripting

Shell script to read a text file line by line & process it...

Hi , I am trying to write an shell, which reads a text file (from a location) having a list of numbers of strictly 5 digits only ex: 33144 Now my script will check : 1) that each entry is only 5 digits & numeric only, no alphabets, & its not empty. 2)then it executes a shell script called... (8 Replies)
Discussion started by: new_to_shell
8 Replies

6. Shell Programming and Scripting

Shell script to read multiple options from file, line by line

Hi all I have spent half a day trying to create a shell script which reads a configuration file on a line by line basis. The idea of the file is that each will contain server information, such as IP address and various port numbers. The line could also be blank (The file is user created). Here... (1 Reply)
Discussion started by: haggismn
1 Replies

7. Shell Programming and Scripting

HELP: Shell Script to read a Log file line by line and extract Info based on KEYWORDS matching

I have a LOG file which looks like this Import started at: Mon Jul 23 02:13:01 EDT 2012 Initialization completed in 2.146 seconds. -------------------------------------------------------------------------------- -- Import summary for Import item: PolicyInformation... (8 Replies)
Discussion started by: biztank
8 Replies

8. Shell Programming and Scripting

Read line from the file and append it to each row

Hi All, We have a file in the following format: 0.010000 $ ITI 11 LV2 $ 40456211 $ 0.135000 $ ITI 11 LV1 $ 40512211 $ 1.215600 $ ITI 11 ITI3 $ 41406211 $ 24/05/2014 14:05:02 0.030000 $ ITI 11 LV2 $ 40456211 $ ... (3 Replies)
Discussion started by: gauravsinghal79
3 Replies

9. Shell Programming and Scripting

Needed shell script to append desired text to each line in a file

Hi, I had generated a report in my tool as followsoutput.txt 43.35 9 i needed the script to generate a new file like below i want to append the text to each of these lines of my filenewoutputfile.txt should be Total Amount : 43.35 Record Count:9 Regards, Vasa Saikumar. ... (2 Replies)
Discussion started by: hemanthsaikumar
2 Replies

10. Shell Programming and Scripting

Shell script UNIX to read text file line by line

i have a text file as belows, it includes 2 columns, 1st is the column name, 2nd is the file_name data_file.txt column_name file_name col1 file1 col2 file2 col3 file1 col4 file1 col5 file2 now, i would like to... (4 Replies)
Discussion started by: tester111
4 Replies
nmea(n) 						   NMEA protocol implementation 						   nmea(n)

__________________________________________________________________________________________________________________________________________________

NAME
nmea - Process NMEA data SYNOPSIS
package require Tcl 8.2 package require nmea ?0.1.1? ::nmea::open_port port ?speed? ::nmea::open_file file rate ::nmea::input sentence ::nmea::configure_port settings ::nmea::close_port ::nmea::close_file ::nmea::do_line ::nmea::log file ::nmea::checksum data ::nmea::write sentence data _________________________________________________________________ DESCRIPTION
This package provides a standard interface for writing software which recieves NMEA standard input data. It allows for reading data from COM ports, files, or programmatic input. It also supports the checksumming and logging of incoming data. After parsing, input is dis- patched to user defined handler commands for processing. To define a handler, create a proc with the NMEA sentence name in the ::nmea namespace. For example, to process GPS fix data use "proc ::nmea::GPGSA". The proc must take one argument, which is a list of the data val- ues. COMMANDS
::nmea::open_port port ?speed? Open the specified COM port and read NMEA sentences when available. Port speed is set to 4800bps by default or to speed. ::nmea::open_file file rate Open file file and read NMEA sentences, one per line, at the rate by rate in milliseconds. The file format may omit the leading $ and/or the checksum. If rate is <= 0 then lines will only be processed when a call to do_line is made. The rate may be adjusted by setting ::nmea::nmea(rate). ::nmea::input sentence Processes and dispatches the supplied sentence. If sentence contains no commas it is treated as a Tcl list, otherwise it must be standard comma delimited NMEA data, with an optional checksum and leading $. ::nmea::configure_port settings Changes the current port settings. settings has the same format as fconfigure -mode. ::nmea::close_port Close the open port ::nmea::close_file Close the open file ::nmea::do_line If there is a currently open file, this command will read and process a single line from it. Returns the number of lines read. ::nmea::log file Starts or stops file logging. If a file name is specified then all NMEA output will be logged to the file in append mode. If file is an empty string then any logging will be stopped. ::nmea::checksum data Returns the checksum of the supplied data ::nmea::write sentence data If there is a currently open port, this command will write the specified sentence and data in proper NMEA checksummed format. VARIABLES
::nmea::checksum A boolean value which determines whether incoming sentences are validated or not. ::nmea::rate When reading from a file this sets the rate that lines are processed in milliseconds. BUGS, IDEAS, FEEDBACK This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category nmea of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation. KEYWORDS
gps, nmea COPYRIGHT
Copyright (c) 2006-2007, Aaron Faupell <afaupell@users.sourceforge.net> nmea 0.1 nmea(n)
All times are GMT -4. The time now is 10:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy