Jump to content

Recommended Posts

  • Moderators
Posted

JailDoctor,

Running this:

#include <File.au3>
_FileWriteToLine("Test.txt", 1, "", 1)
ConsoleWrite(FileRead("Test.txt") & @CRLF)

returns this:

--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
2 Do not delete
3 Do not delete
4 Do not delete
5 Do not delete
6 Do not delete

Which I presume is what you want. So the problem must lie elsewhere in those 7k lines. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted (edited)

Thanks Melba,

Could it possible have to do with the numbers at the beginning of each line?

It does work on the files I need to concatenate. Tab delimited txt files that list the field names at the top. I only need the name of the fields on the first page, not the rest.

Edited by JailDoctor
Posted

That's why when I code in the Windows environment I make sure a EOLs are rn (@CRLF) as problems like this don't arise.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

  • Moderators
Posted

JailDoctor ,

And here is an SRE to do just that:

$sText = StringRegExpReplace($sText, "((?<!\x0d)\x0a|\x0d(?!\x0a))", @CRLF)

It replaces any @CR without a following @LF, or any @LF without a preceding @CR, to @CRLF. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted

Beat me to it.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

Thanks Melba, this is going to be very useful because I am now working with a bunch of txts from different sources and of course each one of them assures me their format is the correct format. :shifty:

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...