multiple awk commands

how to grep multiple awks

$ awk '{print;}' employee.txt
100  Thomas  Manager    Sales       $5,000
200  Jason   Developer  Technology  $5,500
300  Sanjay  Sysadmin   Technology  $7,000
400  Nisha   Manager    Marketing   $9,500
500  Randy   DBA        Technology  $6,000


$ awk '{print $2,$5;}' employee.txt
Thomas $5,000
Jason $5,500
Sanjay $7,000
Nisha $9,500
Randy $6,000

in above query how to tweak to see  see all records whose name starts with 'S' and Salary greater than '6000'

also
in above query how to tweak to see  see all records whose name starts with 'S' and Salary greater than '6000' and Department Starts with  'T'


100  Thomas  Manager    Sales       $5,000     08/08/1988 6:00:01AM
200  Jason   Developer  Technology  $5,500 08/08/1989 7:00:02AM
300  Sanjay  Sysadmin   Technology  $7,000 08/08/1982 9:00:03AM
400  Nisha   Manager    Marketing   $9,500 08/08/1981 10:00:04AM
500  Randy   DBA        Technology  $6,000 08/08/1981 11:00:5AM
if it has joined date and time as above
in above query how to tweak to see  see all records whose name starts with 'S' and Salary greater than '6000' and Department Starts with  'T' and joined between particular date time to particular date time say  08/08/1982 9:00:03 AM till 08/08/1981 10:00:04AM
i need to use above in a zgrep command

https://www.thegeekstuff.com/2010/01/awk-introduction-tutorial-7-awk-print-examples/
http://www.theunixschool.com/2012/09/grep-vs-awk-examples-for-pattern-search.html

Please advise
LVL 7
gudii9Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nociSoftware EngineerCommented:
Should be easy:  
$ awk '{print $2,$5;}' employee.txt | egrep '^S[^ ]* \$[789],'
Sanjay $7,000

Open in new window

Right answer?,, well there is a problem here can you tell me what it is?
So maybe not the right one.  

More a Pure AWK solution...
 awk '{X=substr($5,2); sub(",","",X); if (substr($2,1,1)=="S" && substr($4,1,1)=="T" && X > 6000) { print $2,$4,$5;}}' employee.txt 
Sanjay Technology $7,000

Open in new window



Please check the awk man page  https://linux.die.net/man/1/awk for more info to solve the last Q....
PLease take a stab at it and show the result (or the part you could accieve).
arnoldCommented:
Noci covered...
Awk parser, separates fields based on white space in the example, with the first element stored in $1 with NF representing the number of fields. In a line.


When processing text, look at using perl provides a single mechanism that does not need to hand off ....
murugesandinsShell_script Automation /bin/bash /bin/bash.exe /bin/ksh /bin/mksh.exe AIX C C++ CYGWIN_NT HP-UX Linux MINGW32 MINGW64 SunOS Windows_NTCommented:
#Noci covered...
#:)
/usr/bin/awk '{
                X=substr($5,2);
                sub(",","",X);
                if ( substr($2,1,1)=="S" && substr($4,1,1)=="T" && X > 6000 )
                {
                        print $2,$4,$5;
                }
}' employee.txt
#@gudii9
# Use values on the left and variables/functions on the right during comparison.
# We can also use substr( $NF, 2, length( $NF) )
# Use related path when using any execuable/files ./employee.txt
/bin/awk '{
        if ( ( "S" == substr( $2, 1, 1) ) && ( "T" == substr( $4, 1, 1) ) && ( 6000 < substr( $NF, 2 , length( $NF) ) ) )
        {
                printf( "%s %s %s\n", $2, $4, $NF);
        }
}' ./employee.txt

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.