Posts: 74
Joined: Sat Aug 24, 2013 2:41 pm

White Space Issues

Sat Mar 22, 2014 11:50 am


while setting up a 3G modem, I configured wvdial and had lots of trouble.

I copied the configuration from into Nano

And I got error messages that there was no Dialer Section 3gconnect when using this config file.

From my early Linux experience many years ago, I remembered that this could be due to "white space issues" eg the ^M problem.

But I could not remember how to view the "white space characters"

In the end I manually deleted all the spaces and end of lines and replaced them by hand with the required character (space bar or enter key)

This did solve the problem.

What is the better way of correcting such problems?
How can one make it visible easier?
and how does one prevent it from happening?

Setting up your Raspberry Pi to work with a 3G dongle

User avatar
Posts: 36810
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: White Space Issues

Sat Mar 22, 2014 11:55 am

Easier than trying to see them is to simply get rid of them
sudo apt-get install dos2unix

dos2unix windows.text.file.txt

If you use vi (aka vim) it will show the DOS chars.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
Posts: 15865
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: White Space Issues

Sat Mar 22, 2014 1:27 pm

Using the "file" command can help you detect those bad line endings.

As an example I created a Linux text file called "jim" and then made a copy of it with "DOS" style line endings called fred. This is the ouput of using the "file" command on them.

Code: Select all

pi@raspberrypi:~$ file fred jim
fred: ASCII text
jim:  ASCII text, with CRLF line terminators
You can then fix the file using a number of methods, but the way dougie suggested is a good one.

Return to “Troubleshooting”