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 |
c program to implement unix/linux command to block the signal ctrl-c and ctrl-\ signal during the execution ls -l|wc -l
Differentiate between ‘ and ” quotes.
What is the lifespan of a variable inside a shell script?
What can scripts do?
What is the difference between running a script as ./scriptname.sh and sh scriptname.sh
What is sed in shell script?
Why is used in shell scripting?
What is the equivalent of a file shortcut that we have a window on a linux system?
How can we find the process name from its process id?
how to create purchase order
How to sort a result of Ls -l command based on columns. Ex. i want to sort 5th column from output of ls -l command.
What is the use of script interpreter in shell scripting?