Question: Question statement: Given file.tsv (file includes MANYY rows and 8-9 columns), use bash (Shell) to find the rows that contain either of two words in
Question statement: Given file.tsv (file includes MANYY rows and 8-9 columns), use bash (Shell) to find the rows that contain either of two words in a column (i.e., say one word is 'hello' and the other word is 'hi'. Identify rows that contain either of these two words in the column called 'greeting') and do not have a word in another column (i.e., word 'USA' in column called 'location)). The final output should contain line numbers that meet this criteria.
I am trying to solve this question using the code: grep -nE '(hello|hi)\t^((?!USA).)*\t' file.tsv However, this is not giving me any response in my terminal (i.e., I am using Bash (Shell). I should be getting line numbers that meet the criteria specified in the question. Please let me know what I am doing wrong, or if I should be using a different grep / awk etc. code. Thank you
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
