OPA JULY 17 Unix 

Fetch employee ,skill wise

Skill details are stored in following format:

Empld ,Name, PrimarySkill , SecondarySkill

Write the unix command(s) to display all the fields mentioned above for all the Employees, whose primary skill is Python and Secondary skill is Oracle . The output records of multiple employees are to be displayed in the ascending order of Name.

Output format: Empld ,Name, PrimarySkill , SecondarySkill are to be displayed with “&” (Excluding double quotes) as the delimiter between the fields/columns of the output records /rows . For more details on format and order of output refer the sample testcase in the below section.

The Skill details details are provided as command line argument when the file containing your command will run. Use appropriate command line argument($1,$2 etc.) to access the details in your file, where you have written the commands.
For more details, please refer to the sample input and output below.

Input data (From Test case input or from Custom input field ) will be supplied to the shell script through commandline argument. You just need to use the appropriate commandline argument in the shell script to read the content/input data and store the same into a file .Finally Process the file towards the given requirement. To test your code with custom input option the respective checkbox needs to be enabled to enter the input data mentioned in the Qn text.

Instructions to read data from custom input text field:

1.The first input line contains the Empld ,Name, PrimarySkill SecondarySkill for the first emloyee and fields/columns of the employee separated by comma.
2. The subsequent lines contains the details of the rest of the employees provided one by one as mentioned in Point#1.

Refer the sample test case below for more details:

Test case Input


Test case output:


In the input list of employees, there are two records with the given primary and secondary skill and the records displayed in the ascending order of Name. Hence record of Latha is displayed as first then record of Raja.








Try in online compiler -> click here

awk 'BEGIN {FS=","} {if($3=="Python" && $4=="Oracle") {print $1"&"$2"&"$3"&"$4}}'| sort -k2 -r