It is currently 31 Oct 2025, 08:25
   
Text Size

files without newline's?

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins

files without newline's?

Postby slapshot5 » 12 Feb 2011, 17:44

Hi all,

Going through some files, I ran across a few that have no newline character at the end of lines.

Take Blood Tyrant for example. It has a carriage return at the end of lines, but no newline.

The couple I spot checked were checked in by Sloth for lazylockie in r6318 and r6319. Can anyone shed light on the exact creation source of these files? In the eyes of *nix, these are not valid txt files for us. And it causes the SetInfo script to go infinitely loopy.

-slapshot5
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: files without newline's?

Postby slapshot5 » 12 Feb 2011, 17:45

I should mention that it's not all files in those checkins. Banshee's Blade is fine for example.
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: files without newline's?

Postby Jaedayr » 12 Feb 2011, 18:56

setInfoScript has locked up on me twice in the last couple days. I am running WinXP and my normal process is to sync with SVN, run setinfoScript and then start testing or creating cards. Today it started, processed Axelrod Gunnarson and locked up. It appears to me that Beacon Behemoth does not have any LF, just CR. Will that cause the script to hang? If so, what is the best way to fix the files?
Jaedayr
Tester
 
Posts: 523
Joined: 08 Jul 2010, 00:06
Has thanked: 16 times
Been thanked: 13 times

Re: files without newline's?

Postby slapshot5 » 12 Feb 2011, 19:01

I'm not sure the best way to find all the affected files, but the best way to fix the is probably a sed command in a shell script.

I never really knew how to use sed. Just enough to be dangerous.
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: files without newline's?

Postby MageKing17 » 12 Feb 2011, 19:13

Just write a script to replace CR with LF.
User avatar
MageKing17
Programmer
 
Posts: 473
Joined: 12 Jun 2008, 20:40
Has thanked: 5 times
Been thanked: 9 times

Re: files without newline's?

Postby slapshot5 » 12 Feb 2011, 21:47

Ok, this seems to be working for me on Mac OS X:
Code: Select all
sed -i -e 's/^M/\'$'\n/g' blood_tyrant.txt
note: the "^M" is types as Ctrl+V,M (still holding Ctrl for the M).

Now, it's a matter of finding all affected files and doing this.

-slapshot5
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: files without newline's?

Postby slapshot5 » 12 Feb 2011, 21:57

Ok. I've got things cleaned up. It was only a couple files. SetInfo script should work again.

-slapshot5
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: files without newline's?

Postby Jaedayr » 14 Feb 2011, 04:16

setInfoScript under WinXP is going into infinite loop still. Should all txt files have CR LF at the end of each line? It looks like Sharding Sphinx, Resounding Thunder have and Resounding Scream have LF only. There may be others but I stopped after I found these.
Jaedayr
Tester
 
Posts: 523
Joined: 08 Jul 2010, 00:06
Has thanked: 16 times
Been thanked: 13 times

Re: files without newline's?

Postby slapshot5 » 14 Feb 2011, 04:22

LF yes, CR, not necessarily.
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: files without newline's?

Postby friarsol » 14 Feb 2011, 04:52

slapshot5 wrote:LF yes, CR, not necessarily.
I think the files that have lines that end with just a Carriage Return without a Newline are the ones that cause problems. Have we figured out what the program is that's causing this problem?
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: files without newline's?

Postby slapshot5 » 14 Feb 2011, 06:03

friarsol wrote:Have we figured out what the program is that's causing this problem?
Not yet to my knowledge.

-slapshot5
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times


Return to Developer's Corner

Who is online

Users browsing this forum: Timothysow and 24 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 25 users online :: 1 registered, 0 hidden and 24 guests (based on users active over the past 10 minutes)
Most users ever online was 9298 on 10 Oct 2025, 12:54

Users browsing this forum: Timothysow and 24 guests

Login Form