Answer the question
In order to leave comments, you need to log in
Need help with awk - write a regular expression to parse a file?
Good afternoon! It's a simple task. There is a telegram console client - you need to parse its logs for the web muzzle through awk.
Here are the logs he keeps:
05 Mar 18 19:33 EET 23670 382477216 Kleino Yaroslav to 224615209 Hermelin Nerz: something is happening 05 Mar
18
19:33 EET 23671 382477216 Kleino Yaroslav to 224615209 Hermelin Nerz: write to me write to me))
33 EET 23672 224615209 Hermelin Nerz to 382477216 Kleino Yaroslav: OK
05 Mar 18 19:33 EET 23673 224615209 Hermelin Nerz to 382477216 Kleino Yaroslav: What is
05 Mar 18 19:33 EET 23674 382477216 Kleinno Yaroslav to 224615209 Hermelin Nerz: Thank you
05 Mar 18 19:33 EET 23675 382477216 Kleino Yaroslav to 224615209 Hermelin Nerz: I'm testing
05 Mar 18 19:33 EET 23676 224615209 Hermelin Nerz to 382477216 Kleino Yaroslav: Still out?
From here we need
19:33 Hermelin Nerz: Still not done?
I parse like this:
cat /home/yaroslav/screen.log | grep Hermelin | awk '{print $4, $8, $14 $15 $16 $17 $18}'
but the result is
19:33 Hermelin Is everything out yet?
how to add spaces to a message?
Answer the question
In order to leave comments, you need to log in
Maybe sed after all?
The output will be:
19:33 Hermelin Nerz: О.о
19:33 Hermelin Nerz: Что такое
19:33 Hermelin Nerz: Всё ещё не вышло?
19:33 Клейно Ярослав: чтото происходит
19:33 Клейно Ярослав: пиши мне пиши))
19:33 Hermelin Nerz: О.о
19:33 Hermelin Nerz: Что такое
19:33 Клейно Ярослав: спасибо
19:33 Клейно Ярослав: я тестирую
19:33 Hermelin Nerz: Всё ещё не вышло?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question