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
ADVERTISEMENT
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
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
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
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
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
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
View Related
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
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
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
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
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
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
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
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
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
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
Sep 3, 2010
I am interested in the following problem: given a string (pattern) find a regexp which match this pattern.
I will need this for a developing of an idea 'pattern based filtration'.
View 3 Replies
View Related
Jul 28, 2010
I have two files :
FileA
prot1
prot5
prot9
prot15
[Code]....
What I need to do is to extract from fileB the fields containing only the strings in fileA.
I thought awk could do the job easily with :
Code:
awk 'BEGIN { RS = "###" } /'$variable'/' fileB > output
where variable would maybe be the output of grep from fileA. So can I store the output of grep in a variable to use it afterwards with awk ?
something like that:
Code:
result=`grep prot. fileA` ; awk 'BEGIN { RS = "###" } /'$result'/' fileB > output
but that doesn't work. I'm always getting the entire fileB.
The output of grep get stored in the variable, I verified that with echo. So there is something that I just don't get... It seems to me that the above line should work.
View 11 Replies
View Related
Jun 9, 2009
I have been messing with diff and grep for 2 days now without result
I am trying to match a file consisting of words to many separate other wordfiles in a specific directory. one by one.
What i want the script to do is to report how many matching words my main file has with every file in the directory, each in turn
setup:
Each of em are plain text files with 1 word per line
Output should be something like:
SCRIPT REPORT:
View 8 Replies
View Related
Feb 5, 2010
Iptables manual page says:
Why doesn't it make sense for packets coming from a wireless interface?
View 1 Replies
View Related
Jun 2, 2011
Just installed OpenSuse 11.4 on a laptop yesterday. Trying to compile VMware player, however my kernel headers are not matching with repo code...
View 9 Replies
View Related
Jul 12, 2010
Im trying to use awk to do matching in only a specific column
example.txt:
www.google.com www.example.com
www.google.com/search www.example2.com
i used:
awk '{ (if $1 == "http://www.google.com") print $2}' example.txt
this awk statement only returns the first line, and i cant seems to make it perform in a way to match based on keywords like GREP. Is there any way to make display the other lines which contains "google" also?
View 1 Replies
View Related
Jul 16, 2010
Linux kernel 2.6, Slackware 12.0.
I do grep -r string_1 .*txt. Is the path first expanded by the shell? If not, then say, ./elem1/elem2/file1.txt would search for string_1. However, it will not in my system. Note: '.' (period) in .*txt is any char. '.' in ./elem1/elem2/file1.txt is current dir. Now, .*txt should be, as a regexp, zero or more occurrences of any char followed by txt, that is, any string with txt as a suffix.
View 3 Replies
View Related
Mar 13, 2011
I have a requirement to list files using find command My folder contains below list of files with out extention.I have a requirement to exclude only ABC.123.* type files and list others. Even though files having MNO contains this pattern i should not exclude. Even if file ends with .txt or .doc it should not be excluded. That is ABC.123.1234.txt should not be excluded.But I am not getting what is required. Can any one please let me know if I am doing wrong any where. As per my requirement I cannot use grep, -regex, or -regex attributes to find command.
View 7 Replies
View Related
Jun 17, 2010
just updated to new 2.6.33.124 kernel along with some other updates to python and boy what a mess!
I can't run at all with the new kernel (the kernel appears to load but stops before the xserver loads, I think)I really don't think this is a generally problematic bug though, i'm afraid that this setup is just fusty since I have been having trouble with metacity (causes the cpu to spin up --metaphorically of course--to ridiculous amounts until I kill the process, which it happily does without actually killing it but it does spin down again to 2-3% from 60% or so) and the python update seems to have killed the nVidia setup and 3D as well. so.... anybody have any suggestions on how to straighten this mess out without setting up again? This is actually the second time I set this up since the metacity bug made me thing it was fusty the first time, but a second setup didn't solve it.
I did turn the metacity bug in as a kernel bug (because it was in some way related to massive kernel ticks which was keeping the cpu going, but have had no response to that, unless this latest update did that.
View 13 Replies
View Related
Feb 22, 2010
How can I remove all .swp files in all of my subdirectories under Linux?
View 4 Replies
View Related
May 19, 2010
I am running Linux and I have some basic console knowledge but my current problem is quite difficult and I dont know how to achieve this. I want/need to rename everything within a folder that matches a given string.
By everything I mean:
folders/files
content within a file
content in hidden files
Basically I want to refactor a Java-project. Sure, I could use Eclipse to handle the replacing, but this leaves out the folders or resources outside of my workspace. I was thinking of a script that could do the job for me but this seems rather tricky. For instance when it comes to folder-/file-rename I want to replace only the part of the name that matches my string, the rest should remain untouched.
View 2 Replies
View Related
Jul 19, 2011
If I wanted to copy all *.so files from src to dst I'd do:
cp src/*.so dst
However, I want to copy all *.so files from src and it's subdirs into dst.
View 2 Replies
View Related
Jan 26, 2010
how I can use the mv command to move a file that matches *.ext regardless of the case?
I would like to be able to move:
*.ext
*.EXT
*.ExT
....and so on with a single command. I do not want to have to type out all combinations of this single file extension in my script because my file system is case sensitive.
View 9 Replies
View Related