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 does echo $0 do?
write a shell script to generate a alert ? like when ur birthday came then generate a alert ur birthday is today like that ?
I have 2 files and I want to print the records which are common to both.
How important is shell scripting?
Explain about echo command?
Set up a Sev 2 alert when the Primary WA service fails. A windows batch script needs to be created that will monitor the WA service on the Primary and when the service stops/fails a Sev 2 TT is generated for a particular team ?
How can we find the process name from its process id?
What are the types of script?
How to redirect both standard output and standard error to the same location?
What is the syntax of "nested if statement" in shell scripting?
Is shell scripting difficult?
What is difference between shell and bash scripting?
What command needs to be used to take the backup?
What does $$ mean in shell script?
How do I run a shell script in powershell?