Question: Given file.tsv, use bash (Shell) to find the rows that contain either 'hello' or 'hi' and do not contain 'USA'. The final output should contain
Given file.tsv, use bash (Shell) to find the rows that contain either 'hello' or 'hi' and do not contain 'USA'. The final output should contain line numbers that meet this criteria. What is wrong with either of my codes to answer this question:
grep -nE ^((?!USA).)*\t(hi|hello)\t file.tsv
grep -n hi\|hello file.tsv | grep -v Comedy file.tsv | cut -d : -f 1
The file has a lot of rows and columns and the output we need here is line numbers that meet the criteria
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
