How can I use sed
to copy before comma and paste after slash in a file?
Example:
text1,Information /
text2,Information /
text3,Information /
and I want
text1,Information /text1
text2,Information /text2
text3,Information /text3
>Solution :
This works with your example:
sed -r 's@(.*),(.*)/@\1,\2/\1@' <file_path>
The idea is that groups (between parentheses) are referenced in the substitution part.