Display word Pattern as well as display line number

I having problems trying to display a word and display the number line as well.  for example:

1234       Pete             Jack      57     m   67000
3456       Jackson         Bill       24     f     56000
9999       Jacksnyder    Mort     37     F    4550
7777       Gundeson      Pam     50    f      3500
leftridge1Asked:
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.

brettmjohnsonCommented:
Is that the input or the desired output?
If it is the input, what is the desired output?
If it is the desired output, what is the input?

It sounds like you want to familiarize yourself with awk.
0
leftridge1Author Commented:
for example I would like to display the word jack as the word or in a pattern search and display the number line as well.  I hope this helps
akw '($0 ~/jack/ {print})' employee
0
leftridge1Author Commented:
My out put should display the word jack or a pattern of jack along with the number displayed.  
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

TintinCommented:
grep -n jack employee
0
leftridge1Author Commented:
I want the out put of this command to show on the screen.  
grep -n jack employee - what about printing the lines that have jack as part of the word or word.
0
TintinCommented:
I'm having trouble following you.

Using your sample input, this is what you should get:

$ cat employee
1234       Pete             Jack      57     m   67000
3456       Jackson         Bill       24     f     56000
9999       Jacksnyder    Mort     37     F    4550
7777       Gundeson      Pam     50    f      3500
$ grep -n Jack employee
1:1234       Pete             Jack      57     m   67000
2:3456       Jackson         Bill       24     f     56000
3:9999       Jacksnyder    Mort     37     F    4550


Note that I did a search on 'Jack' rather than 'jack'.  If you want it to be case insensitive, then do

grep -ni jack employee

How is the output not meeting your requirements?
0
leftridge1Author Commented:
the out is fine accept it doesn't number the lines 1,2,3.  how do I number the lines 1,2,3 instead of 1,6,8,10
0
TintinCommented:
Ahh, when you said line number, I thought you wanted the line number of the match.  If you just want a sequential number then do

grep -i jack employee | nl
0

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
Unix OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.