라인과 하위 라인의 교대 라인을 조정하기 위한 명령

라인과 하위 라인의 교대 라인을 조정하기 위한 명령

입력하다

mykulls1177  MemTotal:     41052672 kB
MemFree:        647480 kB
sandpit  MemTotal:     32959008 kB
MemFree:        227400 kB
greuat  MemTotal:     41052672 kB
MemFree:        336684 kB
mykulls1765  MemTotal:       263771772 kB
MemFree:        104100068 kB
mykulls1766  MemTotal:       528541224 kB
MemFree:        363083156 kB
mykulls1767  MemTotal:       528541312 kB
MemFree:         7703888 kB
mykulls1768  MemTotal:       98289912 kB
MemFree:         3102528 kB
mykulls1769  MemTotal:       98290004 kB
MemFree:         4148740 kB
mykulls1770  MemTotal:       164479104 kB
MemFree:        63983920 kB
mykulls1771  MemTotal:       164479104 kB
MemFree:        33030748 kB
mykulls1773  MemTotal:       98288948 kB
MemFree:        22037620 kB

내가 원하는 출력

mykulls1177  MemTotal:     41052672 kB MemFree:        647480 kB
sandpit  MemTotal:     32959008 kB     MemFree:        227400 kB
greuat  MemTotal:     41052672 kB      MemFree:        336684 kB
mykulls1765  MemTotal:       263771772 kB MemFree:        104100068 kB
mykulls1766  MemTotal:       528541224 kB MemFree:        363083156 kB
mykulls1767  MemTotal:       528541312 kB MemFree:         7703888 kB
mykulls1768  MemTotal:       98289912 kB MemFree:         3102528 kB
mykulls1769  MemTotal:       98290004 kB MemFree:         4148740 kB
mykulls1770  MemTotal:       164479104 kB MemFree:        63983920 kB
mykulls1771  MemTotal:       164479104 kB MemFree:        33030748 kB
mykulls1773  MemTotal:       98288948 kB  MemFree:        22037620 kB

답변1

다음 명령을 사용하면 나에게 잘 작동했습니다.

주문하다

sed 'N;s/\n/ /'  filename

산출

mykulls1177  MemTotal:     41052672 kB MemFree:        647480 kB
sandpit  MemTotal:     32959008 kB MemFree:        227400 kB
greuat  MemTotal:     41052672 kB MemFree:        336684 kB
mykulls1765  MemTotal:       263771772 kB MemFree:        104100068 kB
mykulls1766  MemTotal:       528541224 kB MemFree:        363083156 kB
mykulls1767  MemTotal:       528541312 kB MemFree:         7703888 kB
mykulls1768  MemTotal:       98289912 kB MemFree:         3102528 kB
mykulls1769  MemTotal:       98290004 kB MemFree:         4148740 kB
mykulls1770  MemTotal:       164479104 kB MemFree:        63983920 kB
mykulls1771  MemTotal:       164479104 kB MemFree:        33030748 kB
mykulls1773  MemTotal:       98288948 kB MemFree:        22037620 kB

관련 정보