Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

Copy data of a line in front of the data in the next line

$
0
0

Have data like

start {data}target {ABC}start {data2}target {DEF}target {GHI}start {data3}target {JKL}....

I wish to move the {data} or {data2} which are after the keyword 'start' to their next lines i.e.

start {data}target {data ABC}start {data2}target {data2 DEF}target {data2 GHI}start {data3}target {data3 JKL}....

I tried

sed '/^[[:space:]]*start*/{ N;s/[[:space:]]*target / /}'

But this is not giving the desired output.


Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>