line-endings

How to determine the line ending of a file

I have a bunch (hundreds) of files that are supposed to have Unix line endings. I strongly suspect that some of them have Windows line endings, and I want to programmatically figure out which ones do. I know I can just run flip -u or something similar in a script to convert everything, but I want to be able to identify those files that ...

How to find files with ^M from linux using csh

Is there a csh script/command to list all the files in source source tree which have line endings that show up as "^M" in emacs (under linux). Thanks! ...

Historical reason behind different line ending at different platforms

Why did DOS/Windows and Mac decide to use \r\n and \r for line ending instead of \n? Was it just a result of trying to be "different" from Unix? And now that Mac OS X is Unix (-like), did Apple switch to \n from \r? ...

Python get proper line ending

Is there an easy way to get the type of line ending that the current operating system uses? ...

What does Visual Studio mean by normalize inconsistent line endings?

It occasionally tells me: "The line endings in the following files are not consistent. Do you want to normalize the line endings?" Then gives me a drop down with different standards or something, Windows, Mac, Unix, and a couple Unicode. What the hell does this mean and what is going to happen if I click 'Yes'? ...

Is there an equivalent of BufferedReader.readLine() that lets me pick what my end of line characters are?

The Javadoc for BufferedReader.readLine() says: A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a linefeed. I need slightly better control than this (e.g. I would like to be able to specify that an end of line is "\r\n", so that an "\n"...

Is it possible for git-merge to ignore line-ending differences?

Is it possible for git merge to ignore line-ending differences? Maybe I'm asking the wrong question ... but: I tried uisng config.crlf input but things got a bit messy and out of control, specially when I applied it after the fact. For one thing, applying this config after the fact doesn't seem to affect files that were committed to t...

How should I Fix "svn: Inconsistent line ending style"?

When I run "svn propedit svn:ignore ." at the root of my svn repository, I get this error: svn: Inconsistent line ending style I have tried to run this script: http://blog.eflow.org/archives/130 which runs dos2unix and sets the eol-style on all of the files, however this problem still persists. Any idea what could be wrong? ...

What's a quick one-liner to remove empty lines from a python string?

I have some code in a python string that contains extraneous empty lines. I would like to remove all empty lines from the string. What's the most pythonic way to do this? Note: I'm not looking for a general code re-formatter, just a quick one or two-liner. Thanks! ...

Dealing with files that Git refuses to reset?

I and my collegues are having terrible trouble getting git to behave properly with certain files on our Windows repostiory clones. The clones have been made by cloning a repository which originates on an OSX machine. We have set autocrlf to true, but the problem is that we reguarly find files that git thinks are changed even though we ...

What is the difference between \r and \n?

How are \r and \n different. I think it has something to do with Unix vs. Windows vs. Mac, but I'm not sure how exactly they're difference, and which to search for/match in regexes. ...

Can SQL Server bcp in a file with Unix line endings?

I'm trying to use the SQL Server bcp utility to import a text file from a samba share. bcp is choking on the Unix line endings. I'm sure I could add an intermediate step, either on Unix or Windows, to change the line endings to Windows-style. But I would prefer to import the files from Unix without modification. Anybody know if there's ...

How do I fix line ending issues after migrating from SVN to git?

I just finished converting a Subversion repository to git using git svn clone--stdlayout --authors-file=ourcommitters.txt svn://svn.internalserver.com While doing so, I had the git flag 'core.autocrlf' set to 'true' - just in case that matters. After a long time, the command finished. I cleaned the resulting git repository a bit (del...

git & Cygwin - trailing whitespace causes "not uptodate"

Git on Windows w/ Cygwin is fraught with dangers. However there's one that's really starting to bug me. It's related to the core.autocrlf=true behaviour. After spending a week trawling the 'net it became clear that the problems you'll encounter are less bad with this set. However, if a file has a line with trailing whitespace on the end...

Paste into SQL Server table via Management Studio 2005 and keep line endings

I cannot get this to work. I have opened a SQL Server Express table in SQL Server Management Studio 2005. When I try to paste a multiline text snippet into an NTEXT field it gets truncated to only include the first line. In Access these kind of things works, what should i do? ...

ASP Readline non-standard Line Endings

I'm using the ASP Classic ReadLine() function of the File System Object. All has been working great until someone made their import file on a Mac in TextEdit. The line endings aren't the same, and ReadLine() reads in the entire file, not just 1 line at a time. Is there a standard way of handling this? Some sort of page directive, or ...

Definitive recommendation for git autocrlf settings

I use Windows, Mac OS X and linux on a daily basis. I use git in all these environments, pulling from repos that are used by folks with different choices for line endings. Are there definitive recommendation for setting core.autocrlf in my situation? ...

Textbox line endings on the web?

I have an ASP.Net page with a multi-line textbox on it. Will the line endings on this textbox be according to the server or the client? What I'm asking is if ASP.Net is running in Linux on Mono will the line endings always be \n or will it depend on if the client computer is running Linux? Are line endings in a textbox determined by t...

Possible reasons for tellg() failing?

ifstream::tellg() is returning -13 for a certain file. Basically, I wrote a utility that analyzes some source code; I open all files alphabetically, I start with "Apple.cpp" and it works perfectly.. But when it gets to "Conversion.cpp", always on the same file, after reading one line successfully tellg() returns -13. The code in questi...

How to compare filesizes on Windows and Linux with ascii?

I'm working on a Python script that will upload a bunch of files to an FTP site. To check to see whether the file has changed, I'm comparing file sizes. The problem is, the files I'm uploading have \r\n line endings, but transferring via FTP (ascii mode to a Linux box) converts to \n line endings. Obviously I'm losing a bunch of bytes in...