Grep- result into sorted file

Hello Experts!

I am learning basics of linux.

I have got a file with lots of lines.

I know how to find proper lines using grep but I do not know how to create output file with my result which would be sorted.

Could you please give me any hint about it?

Thank you!

panJames
panJamesAsked:
Who is Participating?
 
Gerwin Jansen, EE MVEConnect With a Mentor Topic Advisor Commented:
As you're learning, one of the basics is that you can send output of one command to the next using the pipe character, like this:

cat file
cat file | grep pattern
cat file | grep pattern | sort

and then redirect the output to a file by adding the redirect > character:

cat file ...   > outputfile
0
 
ozoConnect With a Mentor Commented:
grep -options pattern file | sort -options > output

see
man grep
and
man sort
0
 
ozoCommented:
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
@ozo - cat is just an example in my general explanation, I could have written strings instead...
0
All Courses

From novice to tech pro — start learning today.