Hacker News new | past | comments | ask | show | jobs | submit login

The sed command doesn't get the indentation right, though, as the article says it could be indented by two or four spaces.



   1.sed:
   s/- baz/- elephant/;
   /^  - elephant/{h;G;}
   /^    - elephant/{h;G;}
   s/- elephant/- baz/;

   sed -f 1.sed foo|sed -a wfoo
or

   1.sed:
   /^  - baz/a\
     - elephant
   

   /^    - baz/a\
       - elephant
   

   sed -f 1.sed foo|sed -a wfoo




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: