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


Please Help Members By Posting Answers For Below Questions

What does echo $0 do?

586


write a shell script to generate a alert ? like when ur birthday came then generate a alert ur birthday is today like that ?

3591


I have 2 files and I want to print the records which are common to both.

699


How important is shell scripting?

545


Explain about echo command?

625






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 ?

1716


How can we find the process name from its process id?

709


What are the types of script?

616


How to redirect both standard output and standard error to the same location?

635


What is the syntax of "nested if statement" in shell scripting?

631


Is shell scripting difficult?

559


What is difference between shell and bash scripting?

549


What command needs to be used to take the backup?

528


What does $$ mean in shell script?

588


How do I run a shell script in powershell?

554