Searching for text files with Unix line endings ? Regular Expression ?

V

Valerie Duveny

Hello,

I would like to search for (text) files with unix line endings on my WinXP system.

As well known line endings under WinXP are implemented as hexadecimal 0D 0A
whereas under Unix/Linux line endings are just reperesented by one hex byte: 0A

When I want to search now recursively in a win dirr tree for all text files which contain unix line endings I must somehow
code the following search pattern:

Search for a byte hex 0A which is NOT preceded by a hex byte 0D
If this exist, then this is a text file with Unix file.

How do I code this with an regular expression?

Val
 
P

Pegasus \(MVP\)

Valerie Duveny said:
Hello,

I would like to search for (text) files with unix line endings on my WinXP
system.

As well known line endings under WinXP are implemented as hexadecimal 0D
0A
whereas under Unix/Linux line endings are just reperesented by one hex
byte: 0A

When I want to search now recursively in a win dirr tree for all text
files which contain unix line endings I must somehow
code the following search pattern:

Search for a byte hex 0A which is NOT preceded by a hex byte 0D
If this exist, then this is a text file with Unix file.

How do I code this with an regular expression?

Val

You need to reconsider your search criteria. While it is true that
a Unix-style text file uses $0a as a line terminator, that same
character will also occur in just about all binary files, e.g. in
..exe, .dll, .doc, .xls files.
 
P

Pegasus_fnl

Hello,

I would like to search for (text) files with unix line endings on my WinXP system.

As well known line endings under WinXP are implemented as hexadecimal 0D 0A
whereas under Unix/Linux line endings are just reperesented by one hex byte: 0A

When I want to search now recursively in a win dirr tree for all text files which contain unix line endings I must somehow
code the following search pattern:

Search for a byte hex 0A which is NOT preceded by a hex byte 0D
If this exist, then this is a text file with Unix file.

How do I code this with an regular expression?

Val

You need to reconsider your search criteria. While it is true that
a Unix-style text file uses $0a as a line terminator, that same
character will also occur in just about all binary files, e.g. in
..exe, .dll, .doc, .xls files.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top