I need to search for and replace three consecutive newline characters in an input file and filter them out of an output file for a makefile rule on Centos 4. I am using GNU sed v4.1.2 and GNU make v3.82. I've tried variations on the following with no success thus far:
THREE_LINE_FEEDS := $(shell echo "\012\012\012")
SED_RULE := 's/'$(THREE_LINE_FEEDS)'//'
output.txt: input.txt
sed -r $(SED_RULE) input.txt > output.txt
Using the proposed perl, I get this issue in the shell (adapted from my make rule):
> cat input.txt | perl -e '$/ = undef; _ = <>; s/\n{3}//g; print;' > output.txt
Can't modify constant item in scalar assignment at -e line 1, near "<>;"
Execution of -e aborted due to compilation errors.