Answer the question
In order to leave comments, you need to log in
ubuntu terminal how to use search?
1. Given files consisting of several fields (amount of orders, department name, indexes, etc.), you need to determine the departments (name and city) that received orders for a total amount of more than 1000.
How to do this? I searched, I did not find anything worthwhile, except for: sort -n +7 -8 query1
I.e. the values in the query1 file are simply sorted in ascending order, but how to display only with a value > 1000? And then how else to display only the name of the department and the city?
2. And the second question, how to find the number of unique values in the file in one field (ie, the number of user groups in which they are members) and display them on the screen?
A couple of lines from the file:
7369 JOHN Q SMITH CLERK RESEARCH DALLAS 800
7499 KEVIN J ALLEN SALESPERSON SALES CHICAGO 1600
7505 JEAN K DOYLE MANAGER SALES NEW-YORK 2850
7506 LYNN S DENNIS MANAGER SALES DALLAS 2750
7507 LESLIE D MANAGER2 NEW-YORK MANAGE2 NEW-YORK MANAGE2 NEW-YORK MANAGE2
Answer the question
In order to leave comments, you need to log in
I had to decide like this, it works fine)
grep "^....*\{1\}[0-9][0-9][0-9][0-9]" query1
Where are the departments? I will specify even so, what format of a line? I understand 7369 index, JOHN Q SMITH name, CLERK RESEARCH - subdivision, DALLAS - city, 800 - amount. Do I understand correctly that the string format is variable (i.e. it is impossible to track fields by spaces)?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question