FAQ: Redirection - grep II

This community-built FAQ covers the “grep II” exercise from the lesson “Redirection”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Learn the Command Line

FAQs on the exercise grep II

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!
You can also find further discussion and get answers to your questions over in #get-help.

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head to #get-help and #community:tips-and-resources. If you are wanting feedback or inspiration for a project, check out #project.

Looking for motivation to keep learning? Join our wider discussions in #community

Learn more about how to use this guide.

Found a bug? Report it online, or post in #community:Codecademy-Bug-Reporting

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

I encountered an issue when following the instructions for this exercise. Instruction #1 reads:

  1. Use grep search through the working directory ( /home/ccuser/workspace/geography ) for anything that matches Island . We want the matching filenames and lines.

Problem is that doesn’t work and it prompts you to use Arctic instead, which works. Why is this a case? is it a bug?


HI I used the same grep function but it outputted blank on the second line so what do we do to get it to see if its successful?
I tried something like grep -R Arctic /home/ccuser/workspace/geography | sort > burned.txt
then I typed cat burned.txt
but it outputted blank


I don’t get any output? Is there a bug?


Answer to question 1: grep -R Island /home/ccuser/workspace/geography

Answer to question 2: grep -Rl Island /home/ccuser/workspace/geography

1 Like

Same problem for me, and the same happens on my Terminal. It seems like it works, but no output is returned.

1 Like

Same problem for me:

grep -R Island grep -R Island
grep -R Island /home/ccuser/workspace/geography grep -R1 Island /home/ccuser/workspace/geography

1 Like

I looked in islands.txt:

cat islands.txt
17 26 204

I was mistakenly using R1 when I should have been using Rl i.e. lower case L. The command did not find ant results with R or -R. But I have passed on to next.

I think there’s a bug on this lesson ( snow to rain lesson ). Changing instances of snow to rain works (the results are printed automatically without cat), but when cat is used, all the instances of rain have reverted back to snow

I know it’s a little late but I had the same problem and found that none of the files contained “Island” so nothing was output. I replaced “Island” with “Ocean” then it printed out all the lines with “Ocean”

Is it necessary to use uppercase -R ?
because in the lesson lowercase -r works just fine

You’d best check the man page for your version of grep but on the version I have to hand GNU grep 3.6 the difference is that -R follows symbolic links (in a very simple way you can think of them like shortcuts in windows, web search would explain difference) whereas -r does not follow symlinks. For these examples no it doesn’t matter but when in doubt use man grep and check what options you have.

Edit: Lesson seems to use GNU 3.1, try grep --help since man isn’t immediately available in this lesson.

1 Like