Hello friends,
I am looking for any sed/awk/python script that can identify the position of a character or word in a file. Well, I prefer sed. <space> is a tab space since I actually dont know how to make the forum editor display a space as such.
Sample text
-----------
<space><space><space><space>BAA BAA
<space><space><space>ABC 222 555
<space><space><space><space>XYZ 123
<space><space><space><space>BAA BAA
I would like to manipulate the above two sentences as following.
Result 1 [ backspace 1 (value taken from a variable) ]
--------------------------------------------------
<space><space><space><space>BAA BAA
<space><space><space>ABC 222 555
<space><space><space>XYZ 123
<space><space><space><space>BAA BAA
Result 2 [ space 1 (value taken from variable) ]
---------------------------------------------
<space><space><space><space>BAA BAA
<space><space><space>ABC 222 555
<space><space><space><space><space>XYZ 123
<space><space><space><space>BAA BAA
Result 3 [ copy XYZ from line 2 to line 1 beginning ]
------------------------------------------------
<space><space><space><space>BAA BAA
<space><space><space>ABC 222 555 XYZ
<space><space><space><space>123
<space><space><space><space>BAA BAA
Result 4 [ copy 555 from line 1 to line 2 beginning ]
------------------------------------------------
<space><space><space><space>BAA BAA
<space><space><space>ABC 222
<space><space><space>555 XYZ 123
<space><space><space><space>BAA BAA
Kindly help me or give me a start to achieve this script. Thanks in advance.