help with awk and new line in script

Hi,

I have my script working but only thing is that I am expecting new line for each record but everything is coming in one line.

whats wrong with my awk above? Should i use cat instead of echo?

I need seperate line for each record. I am getting everything in 1 line

awk '!/log/&&/cust System/&&/pdf/ {printf "%s=%s\n\n",$9,$5}' $LOG > /data/file_size.txt

Thanks for the reply. I want to know why the variable I am assigning the value is losing the new line during echoing and writing to a new file?

Hi.

The only way to preserve the whitespace (newlines, etc.) is to quote the variable when you echo it.

$ cat file1
a
b
c

$ X=$(awk '1' file1)

$ echo $X
a b c

$ echo "$X"
a
b
c

Thanks. This works.