Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialA X
12,842 PointsNot understanding the output of $ grep this > hello_grep.txt
Referenced video: https://teamtreehouse.com/library/console-foundations/environment-and-redirection/pipes-and-redirection
Why is $ grep this > hello_grep.txt this is my line another line's result only "this is my line" inside the text file hello_grep.txt and not:
this is my line another line?
1 Answer
Steven Parker
231,275 Points
The command grep this
will show all lines with the word "this" in them.
Since the line "another line" does not contain the word "this", it is not included in the output of the command.
A X
12,842 PointsA X
12,842 PointsSteven Parker : Ah I thought that the "this is my line another line" was replacing the original contents of the file hello_grep.txt... I didn't realize that it was simply running the results of the grep. It makes sense now, but oy, this video confused me enormously!