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
What is bash command used for?
How do I start a shell script?
What command needs to be used to take the backup?
how to print the 2-d, 3-d arrays in unix shell script programs please answer thi questio to my mail venusaikumar@gmail.com
How to write a function?
Explain about return code?
What is shift command in shell script?
How do we delete all blank lines in a file?
Print a given number, in reverse order using a shell script such that the input is provided using command line argument only.
Can you write a script to portray how set –x works?
What is shell and shell script?
What is a file basename?
How can I set the default rwx permission to all users on every file which is created in the current shell?
What are scripts in psychology?
What are the zombie processes?