D
D
Dannerty2018-05-04 15:00:55
linux
Dannerty, 2018-05-04 15:00:55

How to merge lines through grep \ sed into one?

Tell me how you can merge into one line and whether it can be done through grep \ sed.
1 text file, lines of this format
LineA, numberA, number, number
LineB, numberA, number, number
Number, number, LineB, numberB
Number, number, LineA, numberB
Must be converted to:
LineA, numberA, numberB
LineB, numberA, numberB

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
jcmvbkbc, 2018-05-06
@jcmvbkbc

join -t , -j 1 \
    <(sed 's/\([^,]*,[^,]*\).*/\1/g' < 1.txt | sort) \
    <(sed 's/[^,]*,[^,]*,//g' < 2.txt | sort)

D
Dannerty, 2018-05-07
@Dannerty

Openvpn-status.log needs to be processed.
It is necessary to take the name and date and time of connection of the client from the first part of the log, and the virtual ip-address of the client from the second part.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question