D
D
Dima Petrov2019-05-23 09:11:58
linux
Dima Petrov, 2019-05-23 09:11:58

How do I replace characters in square brackets in sed?

there is

11.11.11.11 - - [22/May/2019:16:07:14 +0300] "GET /site/play?cam=358 HTTP/1.1" 301 253 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0"

need to get
11.11.11.11 - - [22.May.2019 16:07:14] "GET /site/play?cam=358 HTTP/1.1" 301 253 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0"

replaced by '.'
I tried to remove the first ':' and remove +* before ] based on this article https://switch-case.ru/60166520 but something did not work out.
just delete everything in brackets.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
Heizenberg, 2019-05-23
@sajor2006

sed 's/\//./' | sed 's/\//./' | sed '0,/:/s// /' | sed '0,/\ +..../s///'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question