shell script to insert data from gps.txt to mysql database

Hi,

     I have gps receiver, by using gpsd data i can read gps log data to my database\(my sql\).

Steps:

  1. telenet localhost 2947 > gps.txt (press enter)
  2. r (press enter) //then i will get the data like below in gps.txt file
      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

-
-
--
--
3. Now, i want to get $GPRMC and write it in new text file way.txt, then from there i can update data into mysql fo every 10 seconds.

What i need,

Here, gps.txt file getting data dynamically..when the line starts from $GPRMC...that line should copy into way.txt this process has to done up to 10 seconds
and after 10 seconds again the process(gps.txt to way.txt) has to start..the data should over write the way.txt file (i can update the data from way.txt to mysql by using cronejob)

If my idea not correct to insert the data into mysql please suggest me new way..to achieve my task.

Please help me regarding this stuff.

Thanks in advance,

sravan

Duplicate thread. closed, continue here: