Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newline problems after SQL call

Status
Not open for further replies.

lhg1

IS-IT--Management
Mar 29, 2005
134
DK
Hi

On a Debian linus server I'm running this simple SQL script, that takes text from a database, and puts it into a file.

Code:
echo "select andet from vagt where vagtdato = CURDATE();" > $tmpdir/Vagt

Vagt1=`mysql -h localhost -u itdrift -ppass itdrift < $tmpdir/Vagt > $tmpdir/t`

But becourse of newlines i am having trouble reading the file.

When I do a "more" on it, i get this.
Code:
andet
\nKl. 00.45 - urner

when I "vi" the file, I can se the etire text
Code:
andet
kl. 21.45 - updated_account. viklende.^M\n^M\nKl. 00.05 - dapteren, men der Jeg kan også se, atmes^M\n^M\nKl. 00.45 - urner


Does anyboddy know how i can get this into linux text format?

/LHG
 
The ^M characters are carriage returns. You can use tr -d '\r' < inputfile > outputfile to remove them.

If there are other wacky characters in there, the strings utility might be what you need.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top