Questions tagged [pattern-matching]

The tag has no usage guidance.

8 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
0answers
26 views

Should I set the locale to `C` when matching a range of numbers?

If I wanted to search for lines in a file that contain a or b or c or d I would run LC_COLLATE=C grep -E '[a-d]' file_to_search or LC_ALL=C grep -E '[a-d]' file_to_search If I fail to set the ...
2
votes
0answers
24 views

why does recursive searching with grep print fewer lines when using \bSTRING\b compared to the -w option?

There are two ways to read all files under the current working directory: grep -rw pip | wc -l grep -r "\bpip\b" | wc -l Assuming 1 and 2 both search the working directory for the whole word "pip", ...
0
votes
0answers
16 views

Find longest matching portion (not in the same offset) within two files

I am wondering if I can compare two files and find longest matching portion not in the same offset Example: File1: 0022222100022222 File2: 0333310003333333 I need to find the matching value (1000) ...
0
votes
4answers
52 views

How to extract word which has only numbers separated by 'dot'

From below lines abcd efgh ijhk lmn opqrs 9.0.8.2c tuv wxyz abcd efgh ijhk lmn opqrs 8.1.3.9b How to extract only 9.0.8.2c 8.1.3.9b
0
votes
1answer
220 views

Sed search and delete matching two patterns one of which is a variable

I have a file that contains multiple instances of code that I need to delete. Here is an example: !/bin/bash mkdir /rootdir/pipeline_runs/oncology/analysis/sample_1_NA172_1 cd /rootdir/pipeline_runs/...
0
votes
1answer
14 views

how to match a column of a file 1 to text of another file 2 then if it matches print file 2

File 1 Name,TaxID,Lineage,Count,Proportion_All(%),Proportion_Classified(%) Acaryochloris marina,155978,Bacteria;Cyanobacteria;;Synechococcales;Acaryochloridaceae;Acaryochloris,4,0.000218669,0....
0
votes
1answer
216 views

print out lines if first three columns match the first three columns in another file

I have file1 which has 3 columns and file2 which has 8 columns. What I wanted to do was if the first 3 columns in file 2 were found in file 1, then print out the entire 8 columns in file 2. I have ...
0
votes
1answer
140 views

Pattern recognition and summing columns between two csv/excel files

I have two files, in which one has data on each person's start date, increment, promotion and other details, and the other file has their research output over the years. Can a script be written in ...