Bad Questions

When people approach others for advice or help in solving a problem, they often find they have a hard time getting the answer they are looking for.

In almost all cases, the cause for this is bad questions. Bad questions don't do anyone any good. It wastes your time, and it means people will be far less likely to even try to help you.

In your best interest, and that of the people willingly offering their advice and experience, here's a few examples of ways questions can go wrong, why they are bad, and how to reformulate them. That way, you will learn to get the correct answers to your questions quickly.

In fact, it is often the case that while giving some thought as to how to formulate your question correctly, many have even solved their own problem they could not solve before.

Lost in the details

The problem here is that this person is trying to put together some of his knowledge to achieve a goal, but doesn't realize that what he knows doesn't actually apply. You cannot edit a file just from the output of a grep operation on it. You're not in the file, you just have a string of characters that represents a line of text that is copied from the file. The real answer here is to use a file editor, such as ed.

How do we reformulate this to get the correct answer?

After I find a line in a file that contains a certain pattern, how do I delete it and the next four lines from the file?

Why is this more correct? We actually formulate what we want, not how we think to solve it. When you have a problem, always express the problem, not your attempt at a solution. Your attempt at a solution failed, therefore, it is very reasonable to assume that attempt at a solution was flawed and basing your question on it will only mislead either the people that will help you or yourself.