Sponsored Content
Top Forums Shell Programming and Scripting shell script to insert data from gps.txt to mysql database Post 302327943 by gudivada213 on Tuesday 23rd of June 2009 02:48:54 AM
Old 06-23-2009
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

Code:
      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
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell Script: want to insert values in database when update script runs

Hi , I am new to linux and also also to shell scripting. I have one shell script which unpacks .tgz file and install software on machine. When this script runs I want to insert id,filename,description(which will be in readme file),log(which will be in log file) and name of unpacked folder... (1 Reply)
Discussion started by: ring
1 Replies

2. Shell Programming and Scripting

How to insert data into MYSql database from a text file

Hi, Need to get help from you guys about this issue. I need to insert data into MySql database from a text file which is located in other server. The text file is something look like below: Date | SubscriberNo | Call Duration 20/7/07 | 123456788 | 20 20/7/07 | 123412344 | 30 The... (4 Replies)
Discussion started by: shirleyeow
4 Replies

3. Shell Programming and Scripting

insert values into sqlplus database using shell script

hello all, I am new to shell scripting and to unix... so the following is my assignment.. here i am trying to insert a values into sqlplus database using shell script. the following is my shell script InsertDelete.sh #! /bin/sh echo "*********The MENU******** 1.Insert The Values... (2 Replies)
Discussion started by: pradeept
2 Replies

4. UNIX for Dummies Questions & Answers

shell script : log to txt and insert new line everytime

Hi, I have this script, while do ps ax|grep 5060 > log.txt echo " " sleep 1 done } I want to actually put a new line everytime the loop is executed in log.txt , but I do not know how to "embed" the echo " " inside the log.txt. (so to say... (1 Reply)
Discussion started by: peuceul
1 Replies

5. Shell Programming and Scripting

Shell script for insert multiple records into a Database

I have a table in an Informix DB into which I want to insert multiple records at a time. Data for one of the column should be unique & other column data may be the same for all the records I insert Typical Insert Statement I use to insert one row : insert into employee(empid, country, state)... (5 Replies)
Discussion started by: nisav
5 Replies

6. Shell Programming and Scripting

Need help on Insert data to phpMyAdmin mySQL database from Shell Script

Sorry to disturb you, I would like to seek help on inserting data whenever the switch is on or off to my phpMyAdmin mySQL database from my Shell Script. I'm using Raspberry PI as my hardware and I have follow this LINK: instructables.com/id/Web-Control-of-Raspberry-Pi-GPIO/?ALLSTEPS to create my... (4 Replies)
Discussion started by: aoiregion
4 Replies

7. Programming

Need help on Insert data to mySQL database

Hi guys, I would like to seek help on inserting data whenever the switch is on or off to my sensor mySQL database in phpMyAdmin from my control.php. I'm using Raspberry PI as my hardware and follow a few tutorials to create my own Web Control Interface, it works perfectly without insert method.... (1 Reply)
Discussion started by: aoiregion
1 Replies

8. Shell Programming and Scripting

Shell script for .Txt to .csv conversion with data processing

Hi experts, I want to convert a txt file having rows and columns (CNAI_DUMP_raw.txt) by comparing it with another text file (paramaters.txt) and generate a output in CSV which contains only 3rd column from CNAI_DUMP_raw.txt, and the columns mentioned in parameters.txt. FYI: There are two... (16 Replies)
Discussion started by: Gautam Banerjee
16 Replies

9. Shell Programming and Scripting

How to get the shell script to read the .txt file as an input/data?

i have written my shell script in notepad however i am struggling to pass the data file to be read to the script the data file is of .txt format. My target is to run the shell script from the terminal and pass 3 arguments e.g. polg@DESKTOP-BVPDC5C:~/CS1420/coursework$ bash valsplit.sh input.txt... (11 Replies)
Discussion started by: Gurdza32
11 Replies
GPSPIPE(1)							GPSD Documentation							GPSPIPE(1)

NAME
gpspipe - tool to connect to gpsd and retrieve sentences SYNOPSIS
gpspipe [-h] [-d] [-l] [-o filename] [-n count] [-r] [-R] [-s serial-device] [-t] [-T timestamp-format] [-p] [-w] [-v] [-D debug-level] [server [:port [:device]]] DESCRIPTION
gpspipe is a tool to connect to gpsd and output the received sentences to stdout. This makes the program useful as a pipe from gpsd to another program or file. gpspipe does not require root privileges, and can be run concurrently with other tools connecting to the local gpsd without causing problems. The output will consist of one or both of the raw NMEA or native gpsd sentences. Each line can be optionally time stamped. There is also an option to exit gracefully after a given count of packets. Optionally a server, TCP/IP port number and remote device can be given. If omitted, gpspipe connects to localhost on the default port (2947) and watches all devices opened by gpsd. gpspipe may be run as a daemon, but requires the -o flag for writing the output to a file. OPTIONS
-h makes gpspipe print a usage message and exit. -d causes gpspipe to run as a daemon. -l causes gpspipe to sleep for ten seconds before attempting to connect to gpsd. This is very useful when running as a daemon, giving gpsd time to start before attempting a connection. -r causes raw NMEA sentences to be output. -R causes super-raw (gps binary) data to be output. This overrides NMEA and gpsd output modes. -s option causes the collected data to be written to the specified serial device with settings 4800 8N1. Thus gpspipe can be used with -s and -r options to emulate a serial port hardwired to a GPS that gpsd is managing. -o option causes the collected data to be written to the specified file. Use of this option is mandatory if gpspipe is run as a daemon. -w causes native gpsdsentences to be output. -t adds a timestamp to each sentence output. -T sets the format of the timestamp. See strftime(3) for the available placeholders. Setting this option implies -t. -p enables dumping of profiling information in JSON. -n [count] causes [count] sentences to be output. gpspipe will then exit gracefully. -v causes gpspipe to show a spinning activity indicator on stderr. This is useful if stdout is redirected into a file or a pipe. By default the spinner is advanced with every messages written; specifying -v more than once will double the number of messages required to rotate the spinner. -V prints the version, then exits. At least one of -R, -r or -w must be specified. EXAMPLE
When gpsd is running gpspipe -r -n 100 will send one hundred raw NMEA sentences to standard output, then exit. SEE ALSO
gpsd(8), gps(1), libgps(3), libgpsd(3), gpsprof(1), gpsfake(1), gpsctl(1), gpscat(1). gpsmon(1). AUTHOR
Gary E. Miller gem@rellim.com. The GPSD Project 03 Aug 2005 GPSPIPE(1)
All times are GMT -4. The time now is 02:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy