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 have a file with columns of the form

number_number  number  columns of numbers

I want to extract the columns beginning with particular numbers. I tried the following, but get nothing in output:

sed -n 's/14_90 2275.*/&/p'

What is wrong with my command?

share|improve this question
up vote 4 down vote accepted

Why don't you use grep which is the right tool for your case? Here is an example to list the files which starts with 14_90 2275:

grep '^14_90 2275' filename

If you still want to use sed, than the right command is:

sed -n '/^14_90 2275/p' filename

If the white spaces are tabs, then you should use:

grep $'^14_90\t2275' filename


sed -n '/^14_90\t2275/p' filename

Or better:

grep $'^14_90\s2275' filename


sed -n '/^14_90\s2275/p' filename

to match any whitespace characters (space, tab etc.).

share|improve this answer
Thanks for your example. In fact, I am reading a tutorial on sed and would like to train using it... – bigTree Mar 24 '14 at 13:22
I just tried this command (with grep )and it doesn't output anything... The columns are separated by tabs but I tried adding a \t and it didn't work neither – bigTree Mar 24 '14 at 13:25
@bigTree I edited my answer to see how you can match any whitespace characters (space, tab etc.). – Radu Rădeanu Mar 24 '14 at 13:42

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.