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

c# - IMAP GMAIL getting folder list problem -

PHP proxy to get XML: problem with URL arguments -