Hi Hrishi,
ok, if you happen to read man page for sed or ed, you will get what it means. But I will go ahead to tell you what this one specifically means
:s ( search and replace)
/ pattern separator (you may use # or ? or some other characters as well, must / is most generic
\esacpe seq for (, where ( marks opening of block pattern ( i m not sure bt the term).
The . means any character, so ... means any 3 characters. so i make 3 blocks, with 3 characters each. they are autmatically marked as 1 2 and 3.
then the second / terminates the pattern to search for. so you have asked so far to search a pattern that has 9 characters, and you have grouped them in 3 groups of 3 characters each. Now you start to replace them, with what ? right, with each of the group separated by a -. so first group is \1, second is \2 third is \3. you can have upto 9 such grouped patterns (here i got the term
, it is called grouped patterns).
and then the last /g, means globally
so search a pattern of 9 characters, grouping them in groups of 3 of 3 characters each and replace them globally by the same grouped patterns separated by hyphen
having said that, if you had more than 9 characters on the line, the rest would be neglected till there were 18, if you had 18, you wud have 6 groups, and so on. try playing with that and read some man page for sed. There is immense pattern help with sed.