Questions tagged [pattern-matching]

The tag has no usage guidance.

14 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
0answers
29 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", ...
1
vote
1answer
17 views

ausearch: NOT operator in string match

When examining network activity logs from audit, I want to exclude a few programs I know, e.g. firefox. ausearch -x firefox -i brings up all firefox-related connections. But common NOT-operators ...
0
votes
0answers
15 views

Finding matches between two files based on two columns not perfectly matching

I am trying to merge two files like these: File1 chr19:clu_14_NA 2.75415627299357e-07 0.000108249659979084 NM_014931.3 chr17:clu_159255_NA 2.81974666270266e-07 0.000109329961143601 ...
0
votes
0answers
8 views

Extracting two patterns from a file on multiple lines with output side by side

I have text report data formatted with an a identifier code on one line and then the account code associated with the identifier code on another line. Sometimes there are multiple account codes per ...
0
votes
0answers
32 views

Comparing two columns of one file with two columns of another file. Python or Bash?

So guys have two files, both of them are tab-separated text files, trying to merge both the files based on two columns. The two files are unsorted and doesn't contain a header. Another thing is that ...
0
votes
1answer
38 views

'expect' not matching server response string

I'm using a bash script to log into a telnet server and execute a number of commands. It looks like: login_and_run.sh #!/bin/bash unset TELNET_USER_NAME_STRING unset TELNET_PASSWORD_STRING unset ...
0
votes
0answers
53 views

grep -f not working with file

I have a file with having patterns separated by new line characters. which matches the patterns i want to find from a file. but when i run command grep -f patterns_file words_file It gives no ...
0
votes
0answers
17 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
56 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
262 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
18 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
278 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
144 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 ...