I know that question sounds a little odd but i will try to explain it more.
I have a file params that looks like this:
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/
What i want to achieve is to move everything after (and with) $ to the right, ie 80th ‘place’ of a line:
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/
We don’t know the exact length of the string before the $ sign. Also the space between must be filled with spaces and nothing more.
As always i need to do it in bash 2.05 probably with sed, awk or sth like that.
UPDATE
I wasn’t specific about how file look like so here’s more:
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
I will not post changed version becouse it would be too long. I want $[string] parts to be moved to the right, but those lines without $ thing will remain as they are.
Based on kojiro’s answer to include the new requirements
Proof of Concept