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.
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 |
How do you debug a script?
How to print all array elements and their respective indexes?
What does sh mean?
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?
Determine the output of the following command: name=shubham && echo ‘my name is $name’.
What command needs to be used to take the backup?
Write a shell script that adds two numbers if provided as the command line argument and if the two numbers are not entered throws an error message.
How do we create command aliases in a shell?
Is shell scripting a programming language?
whta is the use of "exec" command?
Is bash a shell script?
how to read systems current date and time