Awk or grep question -


i have datafile

[abc] def ghi [jkl] [mno] 

from file; can run grep , lines have "[" in them. how can contents of text inside "[]".

for example:

abc jkl mno 

thanks

sed -n 's/\[\(.*\)\]/\1/p' file 

explanation: -n suppresses printing of each line stdout, /p @ end of regex re-enables behavior causing matching lines printed. regex matches between brackets , replaces entire line it.


Comments

Popular posts from this blog

jQuery clickable div with working mailto link inside -

java - Getting corefrences with Standard corenlp package -

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -