TCS IRA 03January 2022 UNIX

 HELLO DORAEMONS,

IN THIS BLOGPOST ,I HAVE SHARED THE RECENTLY ASKED UNIX/BASH QUESTION AND SOLUTION WHICH IS CERTAINLY USEFUL WHEN YOU WANT TO PRACTICE.HOPE THIS BLOG IS USEFUL TO YOU.

You have a file having Soap details . The format of the file is as below ( ' # ' is the field delimeter ) : 

 ID # Name # Quantity # Price

 S101 # lux # 22 # 40

 S234 # liril # 24 # 50

 S341 # mCaffeine # 25 # 301

 S511 # Truefit # 27 # 800 


Write a Unix command to print the total quantity of Soaps with price greater than 300. Print output in following format : 


Total count : < count > 


1)The file name will be provided as a command line argument when the script containing your command will run . 


You can use shell variables ( e.g. $ 0 , $ 1 , $ 2 ) whichever is applicable for your requirement to provide the command line argument . 


For more clarity on inputs and outputs , please refer to the sample input and output below . 


Note : In case there are no records fulfilling the given condition , print below message .


The file name will be provided as a command line argument when the script containing your command will run . 


You can use shell variables ( e.g. $ 0 , $ 1 , $ 2 ) whichever is applicable for your requirement to provide the command line argument . 


For more clarity on inputs and outputs , please refer to the sample input and output below . 


Note : In case there are no records fulfilling the given condition , print below message . No soap found with cost above 300 


Sample Input 1 : 

ID # Name # Quantity # Price 

S101 # lux # 22 # 40 

S234 # liril # 24 # 50 

S341 # mCaffeine # 25 # 301 

S511 # Truefit # 27 # 800 


Output : 

Total count : 52 


Sample Input 2 : 

ID # Name # Quantity # Price 

S101 # lux # 22 # 40

 S234 # liril # 24 # 50

 S341 # mCaffeine # 25 # 300

 S511 # Truefit # 27 # 299 


Output : 


No soap found with cost above 300


Also check solution in my channel:

code doraemon solution


HOPE THIS IS HELPFUL TO YOU GUYS.IF YOU LIKE MY WORK ,CONSIDER SUBSCRIBING TO MY CHANNEL AND FOLLOW MY BLOGPOST FOR MORE UPDATES.



0 Comentarios

Follow Me On Instagram