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
Post a Comment