Article 5P9GY [SOLVED] grep semi-variable pattern

[SOLVED] grep semi-variable pattern

by
Drosera_capensis
from LinuxQuestions.org on (#5P9GY)
Hello everyone,

I have used grep to process data from this input:

Code:Scaffolds_16_pilon ACmerged_contig_2215 5_1009.75816 11_1010 11_1011To that output:

Code:Scaffolds_16_pilon ACmerged_contig_2215 1 5
Scaffolds_16_pilon ACmerged_contig_2215 2 11Part of my script is based on selection the correct first number before the underscore in column three and four.
For this I have used the regexp '$f'_.* to select a specific $f followed by underscore, then a variable pattern.

Code:grep --only-matching '\<'$f'_.*\>' | wc --word
Unfortunately, when $f=5 the script select the three last column and not just the first one. And I don't really understand why. Any idea anyone?latest?d=yIl2AUoC8zA latest?i=0W6jOEnX7Ak:jiqnGDtfTT0:F7zBnMy latest?i=0W6jOEnX7Ak:jiqnGDtfTT0:V_sGLiP latest?d=qj6IDK7rITs latest?i=0W6jOEnX7Ak:jiqnGDtfTT0:gIN9vFw0W6jOEnX7Ak
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments