I'm trying to run the below sed command someone showed me to remove comments, blank lines and line continuations from a file but I get the following label error: Label too long: :loop;/\\$/N;s/\\\n//;t loop
sed '/^ *#/d' <$1 | sed '/^$/d' | sed ':loop;/\\$/N;s/\\\n//;t loop' | sed 's/[ \t]\+/ /g' > $workfile
From what I can figure out its due to the label length only being allowed to have 8 characters.
Is there another way to write the above sed command so that I don't get a label error?
Guess I'm going to have to test the sed bit by bit.. The whole command is just giving me a blank output.. In fact just even trying to remove lines with comments gives me a blank output..
sed '/^ *#/d' <$filename > $workfile
**EDIT**
Eventually got this working but now have an awk related question..
Anyone know if there's an -v alternative for Solaris? Doesn't seem to be supported in my version..
You need to escape the pipe character in the -F option because it is a Shell special character. If this is SunOS, most posters advise not using awk and choosing one of the alternatives instead.