Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This might work for you:</p> <pre><code># sed '\|\(.*\)\($/.*\)|{h;x;s//\2/;x;s//\1/;:a;s/^.\{1,78\}$/ &amp;/;ta;s/^\( *\)\(.*\)/\2\1/;G;s/\n//}' params c ------------------ c Something stupid c ------------------ c there is a number: 9 $/ar_numb/ c a line that looks 1 px 0.9814 $/r_a/ 2 px -0.9814 $/r_a/ 3 p 1 1.732051 0 1.9628 $/x2r_a/ 4 p 1 1.732051 0 -1.9628 $/x2r_a/ 5 p -1 1.732051 0 1.9628 $/x2r_a/ 6 p -1 1.732051 0 -1.9628 $/x2r_a/ c c dirty line 7 cz 0.9347 $/x05d_a/ c very dirty 41 p 0 $/A_Nel/!jl 1 $/B_Nel/!jl 0 $/C_Nel/!jl 0 $/D_Nel/!jl $bad element 42 p 1.723051 $/A_NEel/!jl 1 $/B_NEel/!jl 0 $/C_NEel/!jl 0 $/D_NEel/!jl $kokode nanika kaite kudasai # printf "%.1s" {1..90} 123456789111111111122222222223333333333444444444455555555556666666666777777777788888888889# </code></pre> <p>Explanation:</p> <ol> <li>Only edit those lines that contain <code>$/...</code></li> <li>Copy the line into the hold space (HS).</li> <li>Swap to the HS and delete everything but the string <code>$/....</code></li> <li>Swap back to the pattern space (PS) and do the reverse i.e. delete <code>$/...</code></li> <li>Indent the PS with spaces to the 79th column</li> <li>Swap the spaces at the front of the PS with the non-spaces.</li> <li>Append the HS to the PS i.e. add the <code>$/...</code> string to the end of the line.</li> <li>Delete the embedded newline caused by the <code>G</code> command.</li> </ol> <p>Alternatively:</p> <pre><code>sed '\|\(.*\)\($/.*\)|!{s/.*/printf "%s\n" "&amp;"/;b};s//printf "%-79s%s\n" "\1" "\2"/' params | sh </code></pre> <p>Or with GNU sed:</p> <pre><code>sed '\|\(.*\)\($/.*\)|{s//printf "%-79s%s" "\1" "\2"/e}' params </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload