Grep two files: -F flag gives weird output


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Grep two files: -F flag gives weird output
# 8  
Old 11-16-2017
Quote:
Originally Posted by Don Cragun
What output do you get from the command:
Code:
grep -E 'MEF|SNV' gene

This gives me following output:
Code:
grep -E 'MEF|SNV' ext_gene_list.txt

Quote:
MEF2C
I'm on Unix:

x86_64 x86_64 x86_64 GNU/Linux

---------- Post updated at 09:22 AM ---------- Previous update was at 09:05 AM ----------

I'm unable to understand why I get output for:
Code:
grep -Ff ext_gene_list.txt no_idea.txt

Quote:
19 19256812 19256812 exonic MEF2B,MEF2BNB-MEF2B nonsynonymous SNV
19 19257646 19257646 exonic MEF2B,MEF2BNB-MEF2B nonsynonymous SNV
no_idea.txt is a tab sep file.

There's no gene with name: "exonic" "MEF2B" "MEF2BNB-MEF2B", "MEF2BNB" "nonsynonymous SNV", "SNV"

So if there's no gene, I should not get any output with the above command. Which baffles me with -F file. I'm not sure when to use -F flag.

[/
# 9  
Old 11-16-2017
Blank lines will match any data, artifacts in ext_gene_list.txt will cause erroneous results.

You could try adding -o for "only print matching part of lines" to see what its matching against.
# 10  
Old 11-16-2017
Quote:
Originally Posted by Corona688
Blank lines will match any data, artifacts in ext_gene_list.txt will cause erroneous results.

You could try adding -o for "only print matching part of lines" to see what its matching against.
Thanks this helped.
I have gene "F2" in gene list that matching against no_idea.txt.

Code:
grep -Ff f1.txt f2.txt

This was matching "F2" against File2.
This User Gave Thanks to genome For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Weird output from ps command

Hi Guys, I am regular Solaris user. I came across a weird problem that puzzled me. Hope you guys can help. I found that process's state(command & arguments) in two different variants of ps command is different. Can anyone explain how is this possible? bash-3.2$ ps -eLo pid,s,comm,args |... (2 Replies)
Discussion started by: brij123
2 Replies

2. HP-UX

[Solved] Weird 'ls -l' output

Hello folks, I've found an HP-UX server with a rare 'ls -l' output. Please see the attached file. Anybody knows how can I change the output to not have this extra tabulations? Thanks in advance! (10 Replies)
Discussion started by: carpannav
10 Replies

3. Shell Programming and Scripting

Weird tail output over ssh

Hello; Am trying to correct the formatting of tail output over ssh. Using the following code: echo "" > $FILE for BOX in $SERVERS do echo "Processing on $BOX" |tee -a $FILE echo "===============================" >> $FILE sudo ssh $BOX 'TERMINAL="vt100" /usr/bin/sh -s' <... (2 Replies)
Discussion started by: delphys
2 Replies

4. Shell Programming and Scripting

Traceroute script weird output

This script is giving weird output #!/bin/bash NETPATH=(`/bin/traceroute -n 4.2.2.2 | awk '{print $2}'`) for i in "${NETPATH}" do echo $i done The output: to 11.11.11.1 1.1.1.1 99.111.208.2 traceroute_test.sh traceroute_test.sh (7 Replies)
Discussion started by: thumbs
7 Replies

5. Shell Programming and Scripting

In bash getting weird output from function ?

My script- result="" times() { echo "inside the times function" result=8 echo "Inside function $result" return $result } result=$(times) echo "the value is "$? echo "the value of result $result" when I run I get this, why the value still remain 0. $ ./func the value is 0 the value... (5 Replies)
Discussion started by: boy18nj
5 Replies

6. UNIX for Dummies Questions & Answers

weird 'ls' output

Hi, Anyone knows why I can't display the contents of my directory and how to fix this? http://i50.tinypic.com/4smfth.jpg Thanks in advance for any advise. Deanne Double post. Continued here. (0 Replies)
Discussion started by: Deanne
0 Replies

7. Shell Programming and Scripting

format of output is weird

hi all, have a ksh script which connects to a database and runs a sql and dumps it to a '.csv' file. The problem is the result is in multiple rows with long spaces in between when it should be just a single line and this screws up the format in the '.csv' file. script is : #!/bin/ksh... (1 Reply)
Discussion started by: cesarNZ
1 Replies

8. Shell Programming and Scripting

weird echo output?

#!/bin/bash INPUT=$1 if then INPUT=0$1 TRACKNUMBER=$INPUT fi TRACKNUMBER=$INPUT echo "Track Number:" $TRACKNUMBER if then echo "File Does Not Exist!: split-track"${TRACKNUMBER}".wav" exit 0 fi CUEFILE="$2" (6 Replies)
Discussion started by: TinCanFury
6 Replies

9. Shell Programming and Scripting

weird behavior of grep -P

I met a problem in using grep -P. There is a text file, temp.txt, whose content is: dddd abc I ran the command: grep -P "\s*abc" temp.txt The result I expected is: abc But, the actual result is: dddd abc Could anyone tell me what is wrong? Thanks. (2 Replies)
Discussion started by: pankai
2 Replies

10. AIX

Weird bootlist output

just setup a new system today - 9117 570, using HMC for console but not partitioned. I installed this system twice. the first time it started off as 5300-00, then updated to ML03. before the update, I believe I mirrored the rootvg, and then altered the bootlist, at that point, the display was... (4 Replies)
Discussion started by: davew1099
4 Replies
Login or Register to Ask a Question