Count the total number of records in data table, Programming Languages

Assignment Help:

Make a database that contains emp_no, emp_name, emp_designation and emp_salary. Using filters perform the following:

a.                        Display the names of those employees that have a salary more than 5000.

b.                        Display the names of those employees that have a designation of “Manager” or “Vice President”.

c.                        Count the total number of records.

 echo "Employees whose salary more than 5000"

awk -F "-" '$4 >5000 { printf "%s\n",$2 }' emp.txt

//awk command specifies the selection criteria and action

echo "Employees whose designation is Manager or Vice President"

awk -F "-" '$3 == "Manager",$3 == "Vice President" { printf "%s\n", $2 }'

emp.txt

echo –e "Total no. of Records= \c"

awk -F"-" '{printf "%d\n",NR}' emp.txt|tail -n1

//option of awk –F is used for delimeter and printf is used for printing

Output

 

sh datab.sh

Employees whose salary more than 5000

Narendra

BGates

Employees whose designation is Manager or Vice President

Mittal

Total no. of Records= 3


Related Discussions:- Count the total number of records in data table

Shell script to check whether user has logged in or not, Normal 0 ...

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Creates an object and prompt the user to enter the name, Design an object d...

Design an object definition named Pet, which should have the following fields: name: The name field holds the name of a Pet type: The type field holds the type of anima

Shell script to count characters, Normal 0 false false fals...

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Network security, Term project (you should code a function), demonstrate it...

Term project (you should code a function), demonstrate it to the class and a very breief report (one or two pages) describing what you did. You determine your project (could be imp

Determine the effect of class isze on test scores, Of the 6,325 kindergarte...

Of the 6,325 kindergarten students who participated in the study, almost half or 3,052 were eligible for a free lunch program. The categorical variable sesk (1 == free lunch, 2 = n

Advantages of asp.net mvc framework, Advantages of asp.net mvc framework ...

Advantages of asp.net mvc framework MVC is a conventional style design that many designers are acquainted with. Some kinds of Web programs will advantage from the MVC structur

Fortran function for find and print out all prime number, Write a Fortran L...

Write a Fortran LOGICAL FUNCTION, called "is_prime", which determines if a given integer value is a prime number or not (A prime number is a natural number which has only two disti

Write a program to use a robot to move, Write a program to use a robot to m...

Write a program to use a robot to move the stack of blocks from a source location to a target location, based. Movement of robot arms, picking and dropping, can be controlled usi

determine if dna sequence is periodic or not, A string s is said to be per...

A string s is said to be periodic with a period α, if s is α k for some k > 2. (Note that α k is the string formed by concatenating k times.) A DNA sequence s is called a tande

Write script to clear the variables in the workspace, Write a script called...

Write a script called 'prob2.m' that asks the user if they wish to clear the variables in the workspace. If the user responds with the strings 'y' or 'yes' then the workspace shoul

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd