Q1: You have been given an Array of Strings and you have to find out which string occurrence is maximum. If there is a tie then take the last string. For eg: input = {cat, dog, lion, cat, lion, dog, hen, cat, dog} then output = dog Q2: You have been given a error log file and you have to output the ERROR logs in between any two dates of the month. Q3: you have been given a text file: a) replace word Amazon with Andy in first 50 lines. b) replace word Amazon with Andy from 50th line till the last line. Q4: You have been given a table name world where you would have to output from table city if city is not null else output the table country.
Sigiloso
Q2: You have been given a error log file and you have to output the ERROR logs in between any two dates of the month. $cat file_name | grep "error" | sed -n '/pattern1/ , /pattern2/p' eg: cat abc.log | grep "ERROR" | sed -n '/Oct 13 10:10:10/ , /Oct 15 11:11:11/p' I hope it helps.