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 Posted / 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 View All Answers
wats the deinitions for shell utility and filter?
How to print the first array element?
What is a program shell?
How to get the last line from a file using just the terminal?
What does chmod do?
How do I edit a .sh file?
What is basename in shell script?
How do I open a jshell in cmd?
Determine the output of the following command: name=shubham && echo ‘my name is $name’.
What is the use of a shebang line?
What is awk script?
What does it mean to debug a script?
What are the zombie processes?
What are the different types of shell scripting?
What is the syntax of while loop in shell scripting?