Why won't this low pass filter work in spice?
There are a few issues regarding your code:


In both examples, you end the section with .end. But this .end defines the end of the netlist, but you didn't (purposely) define the start of the netlist.
The parser now will parse R1 in out 1k as title, so there is no conenction between node "in" and node "out", leaving a floating out node.
That will give you the Warning: singular matrix:  check nodes out and out
You can solve this by starting with plain text as first line, or even a white line will do, or use the .title statement.
You use plot to plot a bode diagram, plot only plots the real part, not the magnitude.
Use plot vdb(out) and plot ph(out) instead.


So, I'd suggest to change your code to

Just plain text here, or even a white line will do, or use the .title statement
R1 in out 1k
C1 out 0 100nF
Vin in 0 dc 0 ac 1 sin(0 1 500)

.control
ac dec 1000 10 15kHz
plot vdb(out)
plot ph(out)
.endc

.end