sed "s/\([0-9]\)-\([0-9]\)/\1\2/g" file
Can someone break it down and explain what it will do when run.
Thanks.
sed "s/\([0-9]\)-\([0-9]\)/\1\2/g" file
Can someone break it down and explain what it will do when run.
Thanks.
Your sed command removes a hyphen(ie -) in between two numbers.
Suppose the contents of the file are
10-2
20-20
9-13
Doing sed "s/\([0-9]\)-\([0-9]\)/\1\2/g" file will give you
102
2020
913
Deciphering the regex :
[] - used for a range
\(..\) - used for grouping so that you can use \1 for first match \2 for second and so on.