Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I typed grep ch->spl[4] * into my shell to look for something in a mud code and its broken grep now. Any time I try to grep anything pretty much it puts the spl[4] before the filename like this.

[:spl[4]:spl[4]:spl[4]:spl[4]:spl[4]:spl[4]:spl[4]:spl[4]:spl[4]:act_wiz.c:           if ( vch->timer > 0 )

Question is how do I clear/stop this so I can get my normal grep back?

share|improve this question
Did you try reinstalling grep? Use sudo apt-get install --reinstall grep. – i08in Mar 11 '14 at 13:04
It is possible the command has resulted in extra files in your current directory because of the '>' symbol being interpreted as an output redirection operator. What is the output of 'ls' in the current directory? Do you have any files called 'spl[4]' or something similar? – TooManyKooks Mar 11 '14 at 13:06
up vote 1 down vote accepted

What does grep ch->spl[4] * do? It will search for the pattern ch- in all files (and directories) in your current directory and save the result in the file spl[4]. To avoid this, you should always quote your grep patterns:

grep "ch->spl[4]" *

Still, the behavior you describe is very strange, there is no reason why this would have changed you your grep works. What is probably happening is that you keep searching through the spl[4] file (because you are grepping *) and that file contains the output you see. Chances are that if you delete it, things will go back to normal.

share|improve this answer
Thanks Terdon that was exactly it. It had created a file called spl[4] and a few other variations. On deleting those it went back to normal. – user257089 Mar 12 '14 at 13:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.