Closed:Keep duplicate searches with grep
0
0
Entering edit mode
3.9 years ago
sarbu • 0

Hi there,

I want to find word 1 and word 2 in the file concatenate.txt and find the lines that match. However, if I search for word1 three times, I would like the result to come out 3 times too. I have been trying different grep options but it doesn't work. I have also tried with a loop awk. Would you know how to do it?

$ grep 'word1\|word1\|word1\|word2' concatenate.txt

It returns:

>word1 CCUG 34288 CCUG34288T_0000003
>word2 T14V chromosome, complete genome

My ideal result would be:

>word1 CCUG 34288 CCUG34288T_0000003
>word1 CCUG 34288 CCUG34288T_0000003
>word1 CCUG 34288 CCUG34288T_0000003
>word2 T14V chromosome, complete genome
regex grep • 78 views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 2921 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6