Does grep function define tab delimiter?

I have a question here. I have a source file A that contains a column as shown below:

LG111222332626 2626 TCGA LG111222332626 467789 GCGG ..... 

The column is separated by the "TAB" delimiter. My question is: how to get my wish line from raw file A if I was given a list B, as shown below:

 LG111222332626 2626 LG111222334768 1212 ......... 

I was wondering if the grep function would be able to do something like this

 grep -e "LG111222332626\t2626" 

(but grep doesn't seem to recognize \t here that this is the correct way to do this.)

Thanks to everyone. Sorry if the way to express your problem is a bit confusing, hope you read me =)

+4
source share
2 answers

As pointed out by Kevin in the comments :

Use $'...' instead of "..." to get bash to interpret the tab before bash gets it.

In this case

 grep -e $'LG111222332626\t2626' 

will work.

+4
source

Thanks for the offer, and I got it now using the -P option.

The command is as follows:

 grep -P "LG111222332626"\\t"2626" file_A 
+1
source

Source: https://habr.com/ru/post/1485347/


All Articles