Remove \r \n from database data

test_db=# select address from test_table;

58/171-G, RAJAPURAM,\r                                                                                                                                                                                                                                                                                                                                                                                                              +
PALANIAPPA NAGAR,\r                                                                                                                                                                                                                                                                                                                                                                                                                 +
SALEM
TS.No.5823,SANTHANATHAPURAM FOURTH STREET\r                                                                                                                                                                                                                                                                                                                                                                                         +

 

solution
test_db=# update test_table set address= regexp_replace(address, E'[\\n\\r]+’, ‘ ‘, ‘g’);

test_db=# select address from test_table;

58/171-G, RAJAPURAM,

PALANIAPPA NAGAR,

SALEM TS.No.5823,SANTHANATHAPURAM FOURTH STREET

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s