To start with I am not sure if this is posted in the right section (might as well fit in programming). Being said that I'll present my problem.
As a part of a bigger program (which is basically a bunch of Fortran routines and bash scripts) I added the instruction (found the suggestion in a forum):
sed -i '1d' textfile
which removes the first line of the textfile
and saves changes in the same file. I did this in my Fedora powered laptop and worked like a charm. The problem is that I need to temporarily move the development of the program to a Mac, and after installing all necessary software (gnuplot and such) the program fails at the point where the sed
instruction is called. After checking its help page (in OSX) I found a paragraph that 'confirmed my fears':
The sed utility is expected to be a superset of the IEEE Std 1003.2
The -E, -a and -i options are non-standard FreeBSD extensions and may not
be available on other operating systems.
from what I understand the sed instruction is not standard between Linux and BSD (OSX), right?
Being that the case I consider the safest thing to do is to find an alternative way of removing the first line of my file (something that works in both *nixes).
Is there an alternate method of removing the first line of a file with bash?