TCS PRA 1 JUN- Unix: Orders and Customer

 

TCS PRA 1 JUN- Unix: Orders and Customer

 



Order details are stored in an input file in the following format:

 

Order Id, Item name, Quantity, Customer

0123;Pen;30;Ananata Gogol 

0778;Pencil;200;Biraj Phukan

0234;Pen Holder;230;Haren Borah

0891;Pen;60;Juthika

07111;Eraser;100;Anjana

012221;Water Colour;20;Nirupam 

 

 

Write the unix command to find the Order id of the orders placed by customers whose name starts with A or N or H.

e.g. once you command is run, if the input file contains the names given above, the output will be:

 

0123

0234

07111

012221 

 

 

Refer to the example below for more clarity on input and output format. 

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

 

Note

Please note that the input file is already configured which contains the input for the test cases i.e. the list of names If you are testing your script or command with customized input/console option, then you have to enter the data(list of names to be in the file) in the custom input text box.

 Your script / command will receive the input data from the file mentioned above automatically through command line.

You need to write the command to access / read the input file (supplied as command line argument to your script) and process the data to produce the required output .

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

 

Example: 

 

Sample 1 

 

Input:

Output

Order Id;Item name;Quantity;Customer 

0123;Pen;30;Ananata Gogoi 

0778;Pencil;200;Biraj Phukan 

0234;Pen Holder;230;Haren Borah 

0891;Pen;60;Juthika 

07111;Eraser;100;Anjana 

012221;Water Colour;20;Nirupam 

0123 

0234 

07111 

012221 

 

 

 

 

 

Sample 2: 

Input:

Output:

Order Id;Item name;Quantity;Customer 

0123;Pen;30;Ananata Gogol 

0778;Pencil;200;Biraj Phukan 

0234;Pen Holder;230;haren Borah 

0891;Pen;60;Juthika

07111;Eraser;100;Ranjan

012221;Water Colour;20;Nirupam 

08901,Pen;100;RIBARAN Das

0123

012221


 


Python EveryDay


 


Comments

Popular posts from this blog

TCS CPA Unix Solution | Xplore UNIX CPA Solution | Calculate Total Asset Price | 27 March

TCS CPA Unix Solution | Xplore UNIX CPA Solution | Count Semesters | 27 March