files without newline's?
Post MTG Forge Related Programming Questions Here
	Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins
			11 posts
			 • Page 1 of 1
		
	
files without newline's?
 by slapshot5 » 12 Feb 2011, 17:44
by 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
			
		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?
 by slapshot5 » 12 Feb 2011, 17:45
by 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?
 by Jaedayr » 12 Feb 2011, 18:56
by 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?
			
		Re: files without newline's?
 by slapshot5 » 12 Feb 2011, 19:01
by 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.
			
		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?
 by MageKing17 » 12 Feb 2011, 19:13
by MageKing17 » 12 Feb 2011, 19:13 
Just write a script to replace CR with LF.
			
		- 
				 
 MageKing17
- Programmer
- Posts: 473
- Joined: 12 Jun 2008, 20:40
- Has thanked: 5 times
- Been thanked: 9 times
Re: files without newline's?
 by slapshot5 » 12 Feb 2011, 21:47
by slapshot5 » 12 Feb 2011, 21:47 
Ok, this seems to be working for me on Mac OS X:
Now, it's a matter of finding all affected files and doing this.
-slapshot5
			
		- Code: Select all
- sed -i -e 's/^M/\'$'\n/g' blood_tyrant.txt
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?
 by slapshot5 » 12 Feb 2011, 21:57
by 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
- 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?
 by Jaedayr » 14 Feb 2011, 04:16
by 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.
			
		- 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?
 by friarsol » 14 Feb 2011, 04:52
by friarsol » 14 Feb 2011, 04:52 
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?slapshot5 wrote:LF yes, CR, not necessarily.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: files without newline's?
 by slapshot5 » 14 Feb 2011, 06:03
by slapshot5 » 14 Feb 2011, 06:03 
Not yet to my knowledge.friarsol wrote:Have we figured out what the program is that's causing this problem?
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
			11 posts
			 • Page 1 of 1
		
	
Who is online
Users browsing this forum: Timothysow and 24 guests
