Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started