OPA JUNE 26 Unix 

Fetch Store records ,Profit wise Store details are stored in following format:

Storeld,Name,Type,Revenue,Profit


Write the unix command(s) to display all the fields in the same order as above for all the Stores ,whose profit is more than or equals to 80 crores. The store details are to be displayed in the ascending order of store wise Profit.
The Store details are provided as command line argument when the file containing your command will run. Use appropriate command line argument($1,S2 etc.) to access the details in your file, where you have written the commands.

Note : Storeld,Name,Type,Revenue, Profit are to be displayed with a “I” as the delimiter in the output

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.


[The first input line contains the Storeld,Name,Type,Revenue, Profit for the first store and fields/columns of the student separated by comma. 2. The subsequent lines contains the details of the rest of the stores provided one by one as mentioned in Point#1.
 

Refer the sample test case below for more details:


• Sample test case


Test case Input:


1,RamsDeptStore,Stationary,100,50
2,RajStore,Departmental,85,80
3,HealthyStore,Grocery,95,92
4,MiniStore,Medical,60,55


Test case output:

2|RajStorepepartmental|85|80
3|HealthyStorelGrocery|95|92

solutions:

 

 

 

 

 

 

 

 

Try in online compiler -> click here

sort -k3 -n -t "," | awk 'BEGIN {FS=","} { if(($5>=80)) {print $1"|"$2"|"$3"|"$4"|"$5}}'

 

©2018 by The real one. Proudly created with Wix.com