Programming :: Importing MYSQL Table From Text File Wo Column Delimiters?

Jun 13, 2011

I am trying to import a data file from old DOS application into MYSQL table The file is clear text file with fixed-width columns, without column delimiters

Example file :


View 3 Replies


Programming :: MySQL And PHP - Table Column With Multiple Values?

Dec 1, 2008

I am writing a script to mine data from my game server logs which are going to mysql. My first question is syslog-ng is sticking $msg into one colum it self, $msg tends to be a long string here are a few examples:

cn name team frag death flags role host.
0 Maik CLA 2 0 0 normal *.70.233.118.
1 lizardncd RVSF -1 3 0 normal
[*.22.247.40] lizardncd fragged Maik.

And they are not always in the same format, How could I parse this data to do something useful, like creating a user stats page with frag counts and flag counts. Should I create a script that runs in a cronjob that parses this data to a new table maybe once a day. Even then the $msg string value is random and I am thinking in terms of awk.

Second. I would like to keep track of what ip's are using what nicknames. Kinda in the sense of and ip associated to a array of names that have been used on that ip address so I can keep track of users. How would this work logically with a mysql db, could a column allow multiple values, then loadable into an array, which then can add, remove, and store to mysql.

View 1 Replies View Related

Programming :: How To Sort Two MySQL Table On Date Or Time Column

Jul 27, 2011

I have two different table in a database in mysql that has no share key with each other and I want to sort them with each other on their date time column I mean when I sort it row X of table A that is older that row Y of table B comes earlier.

View 3 Replies View Related

Programming :: Add A Column To A Text File?

Apr 28, 2011

I have a text field that is just list of servers and I need to add the word hostname in front of them... It must be brain fart but I can't think of how to do this. Basically I need this:


To this:

hostname server1
hostname server2
hostname server3

(And I just mean simply the word "hostname")

View 2 Replies View Related

Programming :: Configure Netfilter By Importing A Text File With C++ Language

Feb 27, 2010

Well my problem is that i want to configure Net filter (FORWARD) not manually but by importing a text file which may contain a binary array with c++ language like :

0 0 1
1 1 0
0 0 1

with 0 is "IPTABLES -A FORWARD -p udp -j ACCEPT"

and 1 is "IPTABLES -A FORWARD -p udp -j DROP"

so after importing i want to find in my firewall 9 rules equal to the numbers of the binary array.

View 1 Replies View Related

Programming :: Getting Table Name From A Text File?

Mar 11, 2011

I have been working on this since 3 days but wasn't able to achieve what I want

I have a big text that has the following format:

Current max fieldLen for table1 (a):
Fld# Width MaxWidth ERR NAME
---- ------ -------------- ------ ---------
2: 80 38 *** field-name
3: 4 2 field-version
4: 40 7 field-value


View 7 Replies View Related

Software :: Importing Text Files Into Mysql Database

Jun 1, 2010

We have an archive server where the administrator, via a web interface, can import text files into a mysql database. The files are typically local to the machine. The operating system of the server is CentOS 5.4, and that of the mysql database is 5.0.77.The database was originally on another server which was replaced by the one that is currently in use. The migration of the database from the older server involved creating a dump file, copying the file to the new machine, and importing it into the database. The version of the mysql database on the previous server was 5.0.45. The problem that has started to occur is the following: When the administrator goes through the motions of importing a text file to the database, the text does not get imported even though there are no error messages appearing on-screen or in the mysqld.log file. The administrator can see what is already in the database, but he cannot add to it.

The web interface to the database utilizes perl modules and cgi files. I ran the cgi files from the command line to see if there were any error messages. There were none. The perl modules that were on the previous server were copied to the new server with the permissions kept intact. I also verified the user and database permissions on the new server match those on the older server. I am at a loss as to why this is occurring, and I would appreciate any help I can get on this. I have enclosed the files that are involved with the importation of the text file into the database as a single text file attachment. The files are all cgi files with the exception of the last file being the perl module.

View 8 Replies View Related

Programming :: Create Regular Expression In Perl To Remove All Delimiters (|) From File?

May 12, 2010

I am trying to create a regular expression in perl to remove all the delimiters (|) from a file. I was also thinking might I be able to use tr?

View 11 Replies View Related

General :: Text File Column Editing

Jul 17, 2011

I have 2 large text files , one looks like this:

<contact type="1"></contact>
<contact type="1"></contact>
<contact type="1"></contact>

The other is a list of emails in single column format like this: , etc

Is there a command to delete all the blahblah emails from text file 1 and replace them with the ones from text file 2?

Or maybe a linux version of 'Csved' which has the ability to add,remove,insert columns?

View 5 Replies View Related

Programming :: PHP Ignores One MySQL Table But Not Others?

Sep 23, 2010

I have just run into a baffling error. I have a database set up in MySQL with six tables. My PHP based website performs queries of all kinds on these tables (SELECT, INSERT, UPDATE, DELETE). On my most recently setup table, the "Orders" table, I am able to perform queries from the server, as well as from my PHP MySQL Admin interface, but all activity from my webpage states that the Orders table does not exist. All other tables are running fine. I have tried rewriting the query script, checked for case sensitivity problems, even cut and pasted other working scripts in place, changing the table and field names as needed. No success. What could cause a single table to not show up like this?

View 2 Replies View Related

Programming :: Unable To Delete A Table In MySQL?

Oct 17, 2010

A sed mishap prior to a database import left me with a table name with, eh, well, this: Code: mysql> show tables;

| Tables_in_someday |
| day20101016 |
| day20101017); |

I've corrected the sed mishap and imported the database the way it was intended Code: mysql> show tables;

| Tables_in_someday |
| day20101016 |
| day20101017); |
| day20101017 |

But I can't seem to drop the table day20101017); because no matter how I seem to escape it it errors.

View 1 Replies View Related

Programming :: Using Perl To Update Mysql Table On Certain Event?

Feb 6, 2011

I'd like to use a perl script to update a fields in mysql database when pianobar (command line pandora radio player) starts a new song. Pianobar has the ability to run a script based on events, I'd like to take advantage of and use perl toparse the artist,song,album and update the corresponding fields. Then later retrieve them and display them with php/html. I am by no means proficient with perl. I started to use bash, but it looks like perl will be much more efficient and and less time consuming.

#! /usr/bin/perl -wT
use strict;


View 2 Replies View Related

Programming :: Bash - Remove From Text Table?

Nov 7, 2010

i have a table in a text file. How can i remove from that table for example "SLS= " if the value is empty? Is it possible to do it in bash awk or sed? [URL]

10.25 SLS=* G.V.=* BBU=122 G.V.=14
10.28 SLS=196 G.V.=198 BBU=* G.V.=*
10.08 U.T.=* I.M=--
10.15 U.T.=-0.522 I.M=*

View 1 Replies View Related

Programming :: Perl: Compare CGI Input With Data From A MySQL Table?

Nov 19, 2008

I have this program:

#! /usr/bin/perl
use DBI ;
use strict ;


and I get this error simply running the program from the command line: DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 at ./submit.cgi line 24.

is this the right syntax to use, both, for this line:

my (@param) = $cgi->param("firstname","lastname","type") ;

as well as this one:

$sth=$dbh->prepare ("SELECT firstname,lastname,type FROM dts WHERE firstname LIKE $param[0] AND lastname LIKE $param[1] and type LIKE $param[2]" );

or should there be quotes around the $param[0] or something? (also is it $param[0] or $param(0)?)

View 1 Replies View Related

Programming :: Shell Script To Get Count Of Records In A Mysql Table?

Oct 23, 2010

I'm using MYTHTV with AT&T's U-Verse system. AT&T apparently turns off the set-top box if the box doesn't receive any commands after some number of hours. When this happens the box takes so long to turn on that it doesn't process the lirc IR channel change command. I've rewritten my channel changer to add a lockfile, and added a cron entry to kick off an entry to just "ping" the set-top box once an hour. But, OK, I'd like to play the bandwidth saving game and not do this if there isn't anything in the "record" table.

So, how would I write a script that will check the number of rows in the "record" table in the "mythconverg" database and exit if there are zero rows? I'm afraid I don't know how to even start this. Here is my "" script that does the pinging:

#if there are no rows in the record table, just exit this script
# lock the lockfile - MUST be same one as channel lock
while [ `lockfile "/tmp/mythchanlock.lck"` ]


View 3 Replies View Related

Ubuntu Servers :: Trying To Insert JPG File Into MySQL Table

Mar 12, 2011

I would like to store JPG files in a mysql database table. I figured that using BLOB fields on the one hand and the 'load_file' command on the other would do the trick. Here is how I set up the table:

mysql> create table blobtable (id int(10) not null auto_increment,
fileName varchar(15) not null,
file longblob not null, primary key(id) );
Query OK, 0 rows affected (0.51 sec)

Then I tried to enter the data:
mysql> insert into blobtable(filename,file)values('pic',load_file('/var/www/temp/IMGP4764.JPG'));

Which got me the following error signal:
ERROR 1048 (23000): Column 'file' cannot be null

It seems to me that the file path to the JPG file (although correct) is the source of the problem, and is causing the load_file command not to work. My first attempt was with the JPG file in my PC's home directory. When that returned the same error message, I figured that maybe the file had to be in the PC's (server's) web area so I put it under the 'www' directory.

View 7 Replies View Related

Programming :: PHP Auto Removes Stale Sessions On It's Own But Doesn't Remove From MYSQL Table

Aug 24, 2010

I know PHP auto removes stale sessions on it's own, but that doesn't remove them from the MYSQL table. So I was gonna make a cron script that ran once every hour that removed any MYSQL shopping cart item from the table if the original session_id that created it does not exist anymore.

From my understanding a session_id is an "actual" file located somewhere on the harddisk (is it not? correct me if I'm wrong), so I was going to do a simple check for each item in the shopping cart to check for it's original session file, if it didn't exist on the harddisk, then simply remove it from the mysql table.

View 1 Replies View Related

Ubuntu :: Output Data From Text File Into A Table?

Apr 13, 2010

I'm having a slight dilemma on reading data from a text file and outputting it into a table then displaying it. Basically I'm writing a shell script that takes information from text files then outputs the data into a table with 4 headings. The extracting of the data is fine, but creating a table i'm having problems with. My code extracts the data outputs the string to another file which works fineThe text file looks like this

mr smith 1 purchase oct 2007
mrs smith 2 purchase nov 2006
i want it to look like this


View 7 Replies View Related

OpenSUSE :: Kmail Akonadi And Mysql Errors - Can't Open And Lock Time Zone Table: Table

May 3, 2010

Kmail 1.13.2 Problem on startup, error is from nepomuk, data storage. "cannot find Redland backend, nepomuk is disabled until fixed. Also see the following error from the akonadi console:

100503 10:00:15 [Note] Plugin 'ndbcluster' is disabled.
100503 10:00:15 InnoDB: Started; log sequence number 0 31413862
100503 10:00:15 [Warning] Can't open and lock time zone table: Table
'mysql.time_zone_leap_second' doesn't exist trying to live without


View 2 Replies View Related

Programming :: DBD::mysql::st Execute Failed: Column Count Doesn't Match Value Count At Row 1

Feb 24, 2010

I have the following perl/DBI script:


use DBI;
my ($db, $user, $pw) = ('dbname', '****', '***********');
my $dbh = DBI->connect("DBI:mysql:$db",$user,$pw) or die "Cannot connect to $db: $DBI::errstr


The error message is

[Wed Feb 24 13:03:27 2010] myscript.cgi: DBD::mysql::st execute failed: Column count doesn't match value count at row 1 at myscript.cgi. [Wed Feb 24 13:03:27 2010] myscript.cgi: DBI::db=HASH(0x8a30c60)->errstr

View 2 Replies View Related

General :: Read Data From Text File And Output Into A Table?

Apr 12, 2010

I'm having a slight dilemma on reading data from a text file and outputting it into a table then displaying it. Basically I'm writing a shell script that takes information from text files then outputs the data into a table with 4 headings.he extracting of the data is fine, but creating a table i'm having problems with. I think it is possible to do it using the awk function, but so far i'm having a lot of difficulties.

View 14 Replies View Related

Programming :: Bash Awk Column To End Of File?

Sep 4, 2010


ls -lhGg | while read line; do echo "$line"; done | awk ' { print $3" "$6 } '

what i want to do is be able to print column 3 and every column greater then 5. Has to be to the end of the line, since different filenames can have different amounts of words in them and the blank space is the separator. my current code works just fine if the file has no blank space.

View 8 Replies View Related

General :: Sort The 3rd Column In A Table Numerically

Jun 22, 2010

i wanna sort the 3rd column in a table numerically ( no actual borders...only tabs seperating the columns)
it should be something like this but i cant get it right

Sort -u +1 -3 results

the file is called results

View 7 Replies View Related

Programming :: Awk Multiple Column Into Single Column?

Jul 15, 2010

I have a multicolumn datas, like

a1 b1 ... f1
a2 b2 ... f2
. . ... .


I would like to make a file with all these data in one column, like



Can it be done with awk or some other command? Also, is it possible then do add another column in front of this one with numbers of the lines (for every previous column), like

1 a1
2 a2
. .
. .


View 14 Replies View Related

Programming :: Script To Read A File And Get Each Column With Varibles?

Jul 2, 2010

i have a script to read a file and get each column with varibles.actually my file: hplog1 sample 3 lines consists of

client1_day- 2010
client2 2009


View 1 Replies View Related

General :: Parsing File With Multiple Delimiters?

Jun 21, 2011

I am using nessus to scan systems, and it generates the report file without any specific delimiter. Shown below is how a typical line in the file reads (It might show up as a very long line.


xx.xx.xx.xx|cpq-wbem (2301/tcp)|49272|REPORT|Synopsis :;;The remote web server is affected by multiple vulnerabilities.;;Description :;;According to its self-reported version number, the HP System;Management Homepage install on the remote host is earlier than 6.2. ;Such versions are reportedly affected by the following ;vulnerabilities :;; - Session renegotiations are not handled properly, which; could be exploited to insert


The field of interest (for me) are IP ADDRESS, Synopsys, Description, Solution and Risk Factor. I tried the following command to parse this:


sed s/:;;/|/g report.nsr | grep Risk Factor |High | awk 'BEGIN {FS = "[:][;][;]"} {printf("%s|%s|%s|%s",$1, $6, $7, $10)}'

But this would not give desired results as ':;;' is not a standard delimiter and hence gives incorrect results. how to grab everything that occurs between the strings 'Synopsys', 'Description', 'Solution' & 'Risk factor' in the above example? In other words i may be asking to use multiple delimiters.. in the order of occurance.. is there a tool that supports multiple delimiters?

View 7 Replies View Related

Programming :: Use Different Starting And Ending Delimiters In Awk To Search For Strings Or Numbers?

Jun 8, 2011

How can i use different starting and ending delimiters in awk to search for strings or numbers like:


now i want string and number as output from above lines. But if i use delimiter as : or ' it will print the entire line coz second delimiter is not same as first one.

View 4 Replies View Related

Programming :: Remove Lines In A Text File Based On Another Text File?

Jan 28, 2009

I have a text file called file1.txt containing many lines eg.


Then i have another text file called file2.txt contains


Is there a command to remove the lines in file1.txt based on the keywords in file2.txt? note: It should remove line3,line5,line6 based on 3,5,6

View 10 Replies View Related

Programming :: Add Blank Lines Whenever The Value Of A Given Column Alters In A Data File?

Jan 7, 2011

All I want is a command that reads one data file with several columns and prints it in another one.However, whenever the value in one specific column alters, it prints one empty line in the new file. For example, consider the file

2.54000000 2.54000000
2.54000000 2.54000000
2.54000000 2.54000000
2.54000000 2.56000000


View 9 Replies View Related

Server :: Mysql 'Table 'mysql.user' Doesn't Exist'?

Aug 2, 2010

I'm trying to setup wordpress on my server, which of course I need mysql for. I setup a database the other day, which worked perfectly, but I had to start again as I put some information in wrong. Now, I can create a database fine, but when I run

GRANT ALL ON wordpress.* TO wordpress@localhost IDENTIFIED BY "password";
I get the output:


View 13 Replies View Related

Copyrights 2005-15, All rights reserved