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 / 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 |
Tell something about the super block in shell scripting?
Can we run shell script in windows?
How to take input values from the user?
How will you emulate wc –l using awk?
is there any command to find user password?
What is the significance of the shebang line in shell scripting?
How to print pid of the current shell?
In a file , how to retrieve the lines which are the multiples of 50 ? like 50,100,150th lines etc.
Print a given number, in reverse order using a shell script such that the input is provided using command line argument only.
write a shell script that counts a number of unique word contained in the file and print them in alphabetical order line by line?
What is the default shell of solaris?
What is the difference between a shell variable that is exported and the one that is not exported?