I was trying to figure out why the checksum of file on the server having different value with the same
file that being optimized by pagespeed.
It turns out, that pagespeed has a filter-whitespace-collapse
and the filter is enabled on our server.This filter will remove any unnecessary whitespace.
So happen that the original file has one end line added, while the file that being optimized by pagespeed doesnt has that.
to quickly validate this.
i tried to search easiest way to check a file with end of line
file that being optimized by pagespeed.
It turns out, that pagespeed has a filter-whitespace-collapse
and the filter is enabled on our server.This filter will remove any unnecessary whitespace.
So happen that the original file has one end line added, while the file that being optimized by pagespeed doesnt has that.
to quickly validate this.
i tried to search easiest way to check a file with end of line
cat -E /tmp/script1
document.write("hello Recently, I published an")$
I can see that the script has end of line, "$" is the indicator.
then i quickly search again, what is the simplest way to remove end of line in linux.
tr -d "\n" < /tmp/script1 > /tmp/script1_removed_el
the command actually will delete all newline in the file and output it to /tmp/script1_removed_el.
Ok this is working for current scenario where my file is expected to be in one line of words. how about if i have more newlines. but i want to delete only the end of line?
:D
Comments
Post a Comment