regex - Sed not reading multiline input? -
i have text below:
path => ["/home/desktop/**/auditd.log", "/home/desktop/**/rsyslog*.log", "/home/desktop/**/snmpd.log", "/home/desktop/**/kernel.log", "/home//desktop/**/ntpd.log", "/home/desktop/**/mysql*.log", "/home/desktop/**/sshd.log", "/hme/desktop/**/su.log", "/home/desktop/**/run-parts(.log" ]
i want extract values inside [
]
, doing:
sed -n 's/.*\[\(.*\)\]/\1/p'
sed not returning anything.
if sed -n 's/.*\[\(.*\)log/\1/p
it's returning string between [
, log
.
"/home/desktop/**/auditd.",
so it's able search within line.
how make work??
edit:
i created file content:
path => [asd,masd,dasd sdalsd,ad asdlmas;ldasd ]
when grep -o '\[.*\]'
not work grep -o '\[.*'
returns 1st line [asd,masd,dasd
. it's working single line not multiple lines.
try doing :
$ grep -o '".*",?' file
output:
"/home/desktop/**/auditd.log", "/home/desktop/**/rsyslog*.log", "/home/desktop/**/snmpd.log", "/home/desktop/**/kernel.log", "/home//desktop/**/ntpd.log", "/home/desktop/**/mysql*.log", "/home/desktop/**/sshd.log", "/hme/desktop/**/su.log", "/home/desktop/**/run-parts(.log"
-o
grep print matching part"
literal double quote.*
anything"
si closing double quote,
literal double quote?
mean o or 1 occurrence
Comments
Post a Comment