Mac sed not the same as linux
I have a bash script that I have used before on Linux and it runs fine on different distros, but not on a MAC. I am trying to read a file and then delete the current line. For some reason on Mac I keep getting the following error message. The file does get read line by line and prints out the correct output, but never deletes the actual line. What would be the equivalent sed command on Mac?
sed: 1: "/tmp/someFile": invalid command code f
while read -r line; do
echo "Run some code"
#move to next line and delete it.
let ++lineno
sed -i "1 d" $inputFile
echo "Deleting line $line"
sleep 1
done < "$inputFile"
The -i
option requires an argument on BSD sed:
sed -i '' 1d "$inputFile"