G
G
Grigory Shepelev2022-04-01 10:12:19
Software testing
Grigory Shepelev, 2022-04-01 10:12:19

How to transfer ip using sed and substitute before a comma?

There is a 1.txt file with the following content:

mail.yandex.net,

mail.mail.ru,
88.88.88.88
mail.mail1.ru,
mail.asdl2.ru,
mail.asd.ru,
77.77.88.88
....

I I want to substitute IP before a comma. As a result, I want to get such a file.

mail.yandex.net,

mail.mail.ru, 88.88.88.88
mail.mail1.ru,
mail.mail2.ru,
mail.mail3.ru, 77.77.88.88
....

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Blokhin, 2016-08-03
@TITnet

Yandex.Tank, Siege, JMeter

O
Oleg Svirchev, 2016-08-04
@svirchoff

Loaddy.com - the only load testing service in Russian

X
xotkot, 2022-04-01
@gshepelev

$ awk '!/,$/{x=x$0}x!=""{print x;x=""}/,$/{x=$0}' 1.txt
mail.yandex.net,
mail.mail.ru,88.88.88.88
mail.mail1.ru,
mail.asdl2.ru,
mail.asd.ru,77.77.88.88

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question