fix sed N and l commands
portability fixes