$ sed "s/\(^[a-z,0-9]*\)\(.*\)\( [a-z,0-9]*$\)/\1\2 \1/g" desired_file_name
I apreciate it even if you only explain part of it or at lest structure it with words as in
Could someone explain what that means, why and are all regEx so ... awful ?
I know that it replaces the first lowcase alphanumerical word with the last one. But could you explain bit by bit what's going on here ? what's with all the
\(.*\)\ and everything else ?
I'm just lost.
EDIT: Here is what I do get:
(^[a-z0-9]*) starting with a trough z and 0 trough 9; and
[a-z,0-9]*$ is the same but the last word (however
[0-9,a-z] = just first 2 characters / first character, or the entire word ?). Also: what does the
* or the
\(.*\)\ even mean ?