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
How do I save a powershell script?
What are the different communication commands available in the shell?
What are the different commands available to check the disk usage?
How to print all the arguments provided to the script?
What is mac default shell?
What is a shell in operating system?
What is .sh file in mac?
How to open a read-only file in the shell?
Calculate a real number calculation directly from the terminal and not any shell script.
What is shell and shell script?
Explain about sourcing commands?
Differentiate between ‘ and ” quotes.
Rewrite the command to print the sentence and convert the variable to plural: echo “i like $variable”.
Write down the syntax for all the loops in shell scripting.
What are the different types of variables used in shell script?