I'd like to add a specific line to a file in a specific line number (second) without over-writing the data which is already there.
I've tried this:
sed -i '2i - jstat' FILE
But this just over-writes the second line with "- jstat".
Instead, I want to add a new second line and push the next line to be number 3. Let's say the file looks like that:
[root@puppet roles]# head -5 !$
head -5 buncher.yaml
classes:
- workspace
- fstab
- role_specific
I'd like to add a new module on the second line and I want the "workspace" module to become the third line.
More than that, I'd like the new line to start with a tab size of 2 chars and then "- jstat" as in: "TabTab - jstat", how can it be done?