HELLO DORAEMONS,
Write the Unix command to display the number of cars who are belonging to car company named Tata Motors and Model Type is EV
The details of the cars are stored in a file(inputfile) in the following format.
Carld*ModelName*CarCompany*ModelType
where symbol "*' is used as the field delimiter for the file. If there is no record in input file or no records satisfying the above criteria, print "No records found"
The file name will be provided as 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, please refer to the sample input and output below.
Note: The string values for CarCompany and ModelType can be in any case, hence search should be case insensitive.
You can use shell variables (e.g. $0,$1,$2) whichever is applicable for your requirement to provide the command line argument.
Lang!
For more clarity, please refer to the sample input and output below.
ALL
Note: The string values for CarCompany and ModelType can be in any case, hence search should be case insensitive.
Sample Input 1:
Carld*ModelName*CarCompany*ModelType
1*Tata Punch*Tata Motors*Petrol
2*Tata Nexon*Tata Motorstev
3*Tigor*Tata Motors*EV
4*10*Hyundai*Petrol
5*i20*Hyundai*Petrol
Output:
2
Sample Input 2:
Carld*ModelName*CarCompany*ModelType
1*Tata Punch*Tata Motors*Petrol
2*Tata Nexon*Tata Motors*Petrol
3*Tigor*Tata Motors*Petrol
4*i10*Hyundai*Petrol
5*i20*Hyundai*Petrol
Output:
No records found
0 Comentarios