Oh, perhaps a little explanation of the sed command might help. As a reminder, here's the command:
sed -n -i '4,$ p' bobdobbs
means "don't print lines to the output file unless specifically requested (with the p command)".
means "edit input files in place - don't write output to standard output - save any output to the input files".
is the name of input file.
The rest is the command. The command is in single quotes to prevent the shell from interpretting meta characters and passing sed something else - sed needs to see this as a literal string.
OK. The command is pretty simple:
Sed commands can be prefixed with an address
. This is to say some expression which tells sed which lines of the input files to execute the rest of the command on. In this case the address is
...which means from line 4 to the end of the file. If we said
...it would mean from line 4 to line 12 (inclusive). $
is a special address meaning "the last line of the input file".
The second part is the actual operation to be performed on lines which match the address. In this case the command is simply p
- print the line. Usually sed will print the line after any operation you specify, but we told it (with the -n option, as described above) not to print output unless we explicitly request it.
So, in summary, 4,$ p
means "if the line number is between 4 and the end of the file (inclusive), print the line".
Hope that helps.
Learn sed. It's time well spent.