Command line: output redirectino and pipline

Screen Link: Learn data science with Python and R projects

My Code:

head -n 1 /home/dq/rg_data/* >>math_dataset
grep -hi ',Math' /home/dq/rg_data/* >>math_dataset

What I expected to happen:
Nice work

What actually happened:

Nothing happen

i see the answer is:

head -n 1 /home/dq/rg_data/Computers\ \&\ Mathematics >>math_dataset
grep -hi ',Math' /home/dq/rg_data/* >>math_dataset

why it needs to indicate in files Computers & Mathematics? the question said " 1. Append the first row of any of the files in rg_data to a new file called math_dataset in your home directory."

Hi @ipngasi:

You should redirect the output of one of the files contained in the directory rg_data and not all of them. I mentioned this also in this topic, which you may find useful.

Hope this helps!

Hi. I’m currently stuck on this lesson too and can’t seem to proceed it.
Am I missing something?

head -n 1 /home/dq/rg_data/Arts >>math_dataset
grep -hi ‘,Math’ /home/dq/rg_data/Arts >>math_dataset

Nothing happens, it just says
bash: math_dataset: Permission denied