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: 40227
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest 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.
Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

User avatar
Posts: 17729
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”