Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 large table from Wikipedia (from the wiki source), and I want to extract a single column, I have it open in vim, and what I want to extract looks something like this

|col||[[what I want]]||another column||another one||et cetera|

Every line has content I want, so I tried:


But I get the error

E486: Pattern not found: \[\[(.+?)\]\]
share|improve this question
up vote 1 down vote accepted

I would cut the content out first, then open it in vi:

cat wikifile.txt | cut -d \| -f 4 > foo
vi foo

Two steps, but two steps I can always remember without much thought.

share|improve this answer



which will return

what i want

I.e. you need to

  • escape the group brackets "(" and ")" and also
  • match the part before and after the interesting column because you want to replace it.
share|improve this answer
Probably safer to use '[^]]*' in place of '.*' in case there are two fields with the double-square brackets around them. – Jonathan Leffler Nov 1 '09 at 20:00

Is this what you want :

1,$ s/^\(.*\[\[\)\(.*\)\(\]\].*\)$/\2/

It check from the begin of the line to [[ -> put it in atom 1, the sentence -> atom 2, the end of line -> atom 3.

Then just display atom 2.

share|improve this answer

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.