Well I also am not a 100% sure of the question, but if I understand correctly, based on your current example:
row1 ✔ no ✔ no
This would end up looking like:
2 row1 ✔ no ✔ no
I would think that it is probably possible, but I very much doubt it is simple or even along the lines you are looking at.
Also, even if it were possible for the single line, you would run into larger issues over multiple lines. If you did use prayag_pjs's
example you would find based on your example that the answer would be:
Which of course would not help
As opposed to btncix I think sed will be almost as much grief (may just be my lack of knowledge) as vi(m) is using this type of functionality so same problem as above.
My choice would be awk or above, like Perl:
Code:
awk -F"✔" '{print (NF-1),$0}' file > new_file
btw. only using your tick as an example as of course awk would not really recognise this symbol.