There is a record with fields namely name,roll
no.,salary,grade etc.Now,write a script to create a file
with multiple records have same combination of fields but
with unique roll numbers.The script should work for
different names in the input file.



There is a record with fields namely name,roll no.,salary,grade etc.Now,write a script to create a..

Answer / sabhapathi

Don't mind my answer is lengthy....
Let file name be employee

name, rollno., salary, grade

cut each of records in each field to temp files as follows:
-----------------------------------------------------------
cut -f1 employee > /sm.tmp.$$
cut -f2 employee > /sn.tmp.$$
cut -f3 employee > /so.tmp.$$
cut -f4 employee > /sp.tmp.$$

Paste them as required in to another file as follows
----------------------------------------------------
paste /sn.tmp.$$ /sm.tmp.$$
paste /sn.tmp.$$ /so.tmp.$$
paste /sn.tmp.$$ /sp.tmp.$$

Is This Answer Correct ?    5 Yes 2 No

Post New Answer

More Shell Script Interview Questions

how will you find the total disk space used by a specific user?

0 Answers  


How does ls command work?

0 Answers  


wats the deinitions for shell utility and filter?

0 Answers  


In my bash shell I want my prompt to be of format '$"present working directory":"hostname"> and load a file containing a list of user-defined functions as soon as I log in, how will you automate this?

0 Answers  


How do I stop script errors?

0 Answers  


What can you do with powershell?

0 Answers  


I have to write Shells (Linux + Unix)for publishing packages and reports. Is it possible ? What are the differents executable programs ineed to call ?

0 Answers  


Is shell and terminal the same?

0 Answers  


In a single command how do you run the previous command in the command prompt.

5 Answers  


How to write a function?

0 Answers  


How do I run a bin bash script?

0 Answers  


write a shell program to check wheather a given string is pallindrome or not?

4 Answers  


Categories