Programming :: How To Do Fuzzy Matching On A MySQL Field

Feb 18, 2011

If I have a MySQL field called, say, "Occupation", which contains "Java Programmer" in it, I would like it to come up when I search for "Java", so that I can get to the other fields in the table.
How do I do this?

View 2 Replies


ADVERTISEMENT

Programming :: MySQL Year Field Range Too Limited

Jul 1, 2011

In the MySQL database for one of my programming projects, I used a "YEAR(4)", because I wanted the column to contain four-digit year values. I discovered, though, that this type only allows values from 1901 to 2155, which is not workable as some year values are previous to the twentieth century. But I do not want a "DATE" type because the month and day are of no interest to me. What type should I convert to that would be the least radical change in data type, while giving more range?

View 1 Replies View Related

Programming :: Awk - Print A Field When Field Position Is Unknown ?

Mar 28, 2010

I'm trying to display fields from flat files where the first 8 fields are always the same. Fields 9 - n are varied but will contain specific patterns I'm after. I'm using this so far because "mySearch" is on each line I want to examine.

Code:

How would you pattern match and include 2 additional fields above field $9 but change field position from line to line?

View 12 Replies View Related

Programming :: Matching Two Tables Of Non-matching Sizes?

Mar 2, 2011

I have two table files with x (1st column) ,y (2nd column) coordinates and intensity (3rd column). I need to match these two tables and divide the intensities at the consecutive coordinates on the 3rd column. The problem is the size of the tables are not same and I want to ignore the lines if they are not in one of the other file.

Here is Table 1:

Code:
-7.500-30.00013.006
-7.500-22.50037.952
-7.500-15.00060.962
-7.500-7.50040.922
-7.5000.00014.348
code....

View 3 Replies View Related

Programming :: Awk Printing From Nth Field To Last Field

Jan 8, 2010

How can print the, let's say 5nd field to the last field of every record (let's say we have 10 fields)?

I mean: I cant avoid to have to do:

print '{$5 $6 $7 $8 $9 $10}'

View 2 Replies View Related

Programming :: Php - Get A Return From A Field Within A Field?

Apr 27, 2009

I am creating a game with random variables. In the game I have created a dialogue exchange to players. I have set up a table with various returns and I inserted {$fields} to represent various random variables. When I call on the requested fields, I only see the field text and my field names. Am I supposed to parse something and call it back another way?

ie: myfield is: "You have won {$random1} silver! <br />{$wi['gender'] majesty rewards you well." the code I am using to call that field is:

View 11 Replies View Related

Programming :: Get A Field Value Corresponding To Another Field Value?

Dec 14, 2010

i have a file : file.dat with following data

Code:

STORAGE PERCENTAGE FLAG:

/storage_01 64% 0
/storage_02 17% 1
/storage_03 10% 0
/storage_04 50% 1

I need to get the value of PERCENTAGE in a variable for a value of storage passed as variable i have tried the following without success like :

Code:

percentage='awk -vx="$defaultStorage" '{FS=OFS=" "}$1==x{print $2}1' file.dat

View 2 Replies View Related

Ubuntu Networking :: MySQL Gammu - Unknown Column Signal In Field List

Feb 12, 2011

I seemed to configure my gammu and changed the version indicated version on my gammu table from 10 to 11 to match the version of my sql, upon starting my gammu-smsd the error:
gammu-smsd[3429]: Error code: 1054, Error: Unknown column 'Signal' in 'field list'
gammu-smsd[3429]: Error code: 1054, Error: Unknown column 'Signal' in 'field list'
gammu-smsd[3429]: Error code: 1054, Error: Unknown column 'Signal' in 'field list'
Kept on repeating on an infinite loop

View 3 Replies View Related

General :: Field-terminating Char Appears Within Field Values?

May 18, 2010

I've had a very colorful morning learning the innerparts of Linux's sort command, and have come across yet another issue that I can't seem to find an answer for in the documentation. I'm currently using -t, to indicate that my fields are split by the comma character, but I'm finding that in some of my files, the comma is used (between double-quotes) within values:

Jonathan Sampson,,foo@bar.com,0987654321
"Foobar CEO,","CEO,",ceo@foobar.com,,

How can I use a comma to terminate my fields, but ignore the occurences of it within values? Is this fairly simple, or do I need to re-export all of my data using a more-foreign field-terminator? (Unfortunately, I do not have any control over declaring a different terminator with this particular project).

View 2 Replies View Related

Programming :: Form Field Validation Using PHP

Sep 10, 2009

I want to validate a web form using PHP. I spent ages confusing myself with client side scripting and realised until I worked out it is not what I want. My problem is that now I am looking at PHP and everything is mixed up in my brain. I need to point out that PHP is very new to me! This is what I already have:
1 An html page with my form on it.
2 PHP page which emails the contents of the form to me.

The above works well. For the sake of clarity, here are my pages (cut down to the essentials where appropriate): My html form:
first name surname
Email  
Home phone
Mobile
Work phone

I have read and understood your terms and conditions. My php script (regform.php)
$receiver = 'me@email'; $subject = 'New registration'; #$message = 'This is a new registration.'; $surname = $_POST['surname']; $firstname = $_POST['firstname']; $address = $_POST['address']; $email = $_POST['email']; $homeph = $_POST['homeph']; $mobileph = $_POST['mobileph']; $workph = $_POST['workph']; $time = $_POST['time']; #from here $oldaddress = $_POST['oldaddress']; $DOB = $_POST['DOB']; $elect = $_POST['elect']; $job = $_POST['job']; $salary = $_POST['salary']; $employer = $_POST['employer']; $benefit = $_POST['benefit']; $smoke = $_POST['smoke']; $claim = $_POST['claim']; $children = $_POST['children']; $children2 = $_POST['children2']; $pets = $_POST['pets']; $pets2 = $_POST['pets2']; $require = $_POST['require']; $terms = $_POST['terms']; $rooms = $_POST['rooms']; $body = "first name:$firstname
surname:$surname
DOB:$DOB
email:$email
home phone:$homeph
mobile phone:$mobileph
work phone:$workph
address:
$address
time at this address:$time
previous address:$oldaddress
electoral register:$elect
employment:$job
employer:$employer
salary:$salary
benefit claim:$benefit
future benefit:$claim
children:$children
ages:$children2
pets:$pet
pet type:$pets2
other requirements:$require
terms:$terms"; $headers = 'From: email' . "
" . 'Reply-To: email "
" . 'X-Mailer: PHP/' . phpversion(); mail($receiver, $subject, $body, $headers, "From: $firstname $surname
" . "Reply-To: $firstname $surname class="inlineimg" />;

You can see there are many more form fields than I have shown in my example html form above. What I want is that the following fields have to be filled:
1 mobileph
2 email
3 terms (checkbox)
I would like the user to be asked to fill the form in properly if any/all of the 3 fields have not been filled in. I imagine I need some php in the html page and some more in the php page. I am certainly not asking any one to do this for me but I am really confused. I have googled and copied and pasted and edited for 6 hours and I am lost. What I want is a very simple and clear example of the code needed. Sorry if I sound as if I can't search properly on Google: in this case I clearly can't!

View 2 Replies View Related

Programming :: SQL -any Value For Numeric Or String Field?

Feb 12, 2010

how do i ask in a query for any numeric or string field? It may not have any meaning, but i need it to fill a toplink DataReadQuery in java....Something like " select * from table where table.fieldA='?'

View 2 Replies View Related

Programming :: ! For Not Matching Bash Regex?

Jan 13, 2011

In a bash-script, only the case if a regular expression does not match is relevant.herefore I used the exclamation mark !. But where to place it?

These two work fine, but are they equivalent?
Code: if ! [[ $abc =~ $pattern ]]; then or
Code: if [[ ! $abc =~ $pattern ]]; then Where is the ! placed more correct?

View 2 Replies View Related

Programming :: Add Texts Using Sed In Matching Pattern?

Feb 3, 2011

I need to add some text using sed before and after the matching pattern. Does any one have any clue?e.g.cat /my/file | sed -e "s/first pattern/New Pattern/g" . /my/file.bakNow I need a result like New Pattern

View 7 Replies View Related

Programming :: Awk Character Position Matching?

Apr 22, 2011

I am trying to check if the 9th character in a file on each line is a v and if so, then print the first word. I've tried a number of variations and am stuck !If it's possible to also check if character position 1 begins with a s in the same awk, that would make it cleaner instead of using egrep.

egrep '^s' file | nawk '{virtual=substr($0,9,1); if ($virtual=="v") {printf "%s", $1}}'
nawk: illegal field $(e)
input record number 1
source line number 1

View 13 Replies View Related

Programming :: Matching Numbers With Nawk

May 11, 2011

I am struggling to understand why nawk matches values that are either 1 or 2 digits in length, but not 100 (3 digits).

Am I missing something obvious ? Should I use substr to remove the % ?

I am sure it's something to do with character and string matching behaviour with nawk.

Code:

View 9 Replies View Related

Programming :: SQL Substring Matching A Character?

Apr 7, 2011

I have the following string:"My dog spot(page 1)". I want just "My dog spot". How do I do this in SQL Server?

View 2 Replies View Related

Programming :: Getting A Particular Field Replaced In A Host List?

Sep 30, 2010

I'm having a bit of a trouble getting a particular field replaced in a host list. I have a MasterHostList which has a comma delimiter for fields and a new line to separate servers.

server1,random,random,group1,random,random
server2,random,random,group1,random,random

I then have a file.list file with a grouping of server names. What I need is to search the MasterHostList and for each server that is in the file.list I need to change the fourth field from group1 to group2 without changing the order or position of anything in the MasterHostList. Obviously the above names are arbitrary.

Failed attempts have been: for SERVER in `cat file.list`; do sed /$SERVER/s/,group1,/,group2,/ MasterHostList MasterHostList.tmp && mv -f MasterHostList.tmp MasterHostList; done for SERVER in `cat file.list`;do awk 'BEGIN { FS=OFS="," } /^${SERVER}/ { $4 = "group2" } 1' ./MasterHostList MasterHostList.tmp && mv -f MasterHostList.tmp MasterHostList; done

Both of these would in various output tests find the correct lines, but it wouldn't change them all correctly.

View 3 Replies View Related

Programming :: Find A Field And Print Its Companion?

Apr 5, 2010

I have a file with variable length lines containing fields separated by colons:

Code:
path/to/file0.c:4150:109:4151:142:4153:275
path/to/file1.c:4040:109
path/to/file2.c:4605:72:4606:109
path/to/file3.c:4380:54

The first field identifies the file name, the second is the search key, and the third is the line number of the file that the search key points to. Any subsequent fields are other key/line number pairs.

As an example, I can search for 4151 (key) from my bash script to identify the file I will have to access, but I also need to capture the line (142) as well, and I can't figure out how to do that using grep, awk or sed (or anything else).

View 2 Replies View Related

Programming :: Make X Number Of Changes Matching Pattern With Sed?

Aug 7, 2010

i tried searching on google but found it difficult to say exactly what I was looking for.Task - Capitalise x number of letters at the start of words.eg. Original line - one.two.three.fourRevised line - One.Two.three.four (here only requiring 2 changes)Test data:

Code:
wire.in.the.blood.s04e01.ws.pdtv.xvid-river.avi
wire.in.the.blood.s04e02.ws.pdtv.xvid-river.avi

[code]...

View 7 Replies View Related

Programming :: Perl Regex Matching HTML?

Mar 19, 2010

I'm trying to find out how to extract the string between the 2 <title> tags: <title>this is what i want</title>.I found lots of results but nothing I've tried works.. EG:$page =~ m/<title>($.)</title>/gism;

View 2 Replies View Related

Programming :: Remove Exact Matching Word Using Sed?

Aug 18, 2009

I have a file which has the words "splashimage and "splash". I would like to remove the word only "splash" from everywhere.

Using the following command code...

View 2 Replies View Related

Programming :: Rename Files Matching A List?

Jul 12, 2009

Is there a way, preferably in python or BASH, to rename files from a list? for instance, track1.mp3, track2.mp3 should be renamed to the names stored in a file listing song names. I have tried to loop a variable through directory listing and renamed them, only to find that filenames with spaces can't be assigned to a variable as a whole. To solve the problem above, I have tried the read command in BASH, which enables the program reading line by line from a list. However, It was failed to pipe the results from directory listing to the read command.

View 14 Replies View Related

Programming :: Sed: Delete Last Line Matching A Pattern?

Mar 27, 2011

I have a question about sed programming, actually a one-liner for which I cannot find a solution, right now. I need to delete a line matching a specific pattern only if it is the last line. In practice, I would put together the following:

Code:
#
# This deletes the last line of a file

[code]...

View 5 Replies View Related

Programming :: Place Another Command Like Grep Or Cut In Address Field?

Jan 28, 2010

The thing is that the command for sed resembles the following

[code]...

Now if I want to place another command like grep or cut in the address field how do I do it. Actually I don't know the line number. The user has to give it as an input. How shall I do that?

View 8 Replies View Related

Programming :: AWK (or TCL/TK): Matching Rows And Columns Between Multiple Files?

May 26, 2011

I've been hitting my head against a wall for awhile with this one:As the last part of some data analysis I performing I would to construct a matrix from a series of different files. These files have the format:

file 1 file 2 file 3
AAAAA .1 AAAAA .1 BBBBB .1
BBBBB .2 BBBBB .1 CCCCC .9

[code]...

View 6 Replies View Related

Programming :: Delete Line In File Matching String?

Jan 26, 2010

Quote:Originally Posted by topcatI would like to know how i can write a shell script to delete a line if a particular pattern exists?E.g. I have a text file with multiple lines. Say 1000s. in the following pattern.

username@email.com:149.0.3.4:1
username1@email.com:149.0.3.4:1
username1@email.net:149.0.3.4:1
username1@email.edu:149.0.3.4:1

If the patternusername@email.com exists then the line "username@email.com:149.0.3.4:1 should be deleted from the file.I have a very similar question but I need to delete one line in a file which matches one very precise instance of a string only. Let's assume I have a file composed of thousands of lines and let's call the file chap-secrets. Let's take the following sample entries:

Code:
#USERNAME SERVER PASSWORD IP
pp pptpd blahblah *

[code]....

View 7 Replies View Related

Programming :: Converting Date Format In A Comma Separated Field?

Apr 9, 2010

I am in the process of learning some scripting, however I am running into a roadblock in specifying a certain time format in the array. Ideally I would like to use Here are the lines of text that I am interrogating:

1123,3/25/2010,00:14 Thu,33229
1124,3/26/2010,13:30 Fri,33230
1125,3/27/2010,04:49 Sat,33231

[code]...

View 2 Replies View Related

Programming :: Multiple Line Pattern Matching And Variable Extraction?

Oct 19, 2010

I have this complex log file filled with entries like

test1-G1/0/0-100-QOS-7001923-ROUTING (ClassMap)
Action: Resolved New
sysName: test1.local

[code]...

View 1 Replies View Related

Programming :: Perl Only Matching Single-character Regex Patterns?

Jan 20, 2009

I'm having a small issue with regex matching in Perl. I'm pretty certain it's a simple fix, but it all looks correct to me...

If I run the following:

Code:

It prints out all the lines containing a 'P', as one would expect. But when the regex is

Code:

I get zero lines printed. It seems to match only single-character patterns.

The file I'm reading is: (It has the same effect whether I leave it with Windows linebreaks or convert them to unix).

Code:

View 3 Replies View Related

Programming :: Perl Regex Not Matching Across Multiple Lines Despite Ms Flags / Fix It?

Aug 16, 2010

I have written a regular expression (tested in regexpal and regextester alpha something) with which I want to replace something like code...

but it only matches functions which occupy one line only, despite my tests showing multiple line matching in javascript testers online and using the m and s flags (which should make it multi line no?)

View 14 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved