A bit of an odd one. I'm using Excel for crunching some data I have in several .txt files.
When I'm trying to import them via Data
> Get External Data
> Import Text File
:
Like as I've done many times in the past, I get the "Choose a File" Dialog Box, but when I browse to the folder, only a couple of the files are "selectable"; the others are "Grayed out":
There are no differences between the files that I can see that would justify the difference. The only "logic" is that the "source" file (let's call it 20150728 - SOURCE.TXT
) comes via email from a Windows machine, and the two other locked files (20150728 - Source Fragment 3.TXT
and 20150728 - Source Fragment 3 copy.TXT
) are a copy of the Source where I've deleted some lines, and a second copy of the resulting file, while the non-locked ones started out as the Source where I deleted lines, and then did a "Save As" in TextWrangler...
I can work around the issue just by copying the contents of the "grayed" files into a new document in TextWrangler and saving it, but I'd like to understand the reason for this behavior.
Doing a file
in the files in question shows them to be similar if not the same:
Mac:samples jjarava$ file 201507*txt
20150728 - Source Fragment 3.TXT: ASCII text
20150728 - Source Framgent 1.TXT: ASCII text
20150728 - Source Fragment 1.TXT: ASCII text
20150728 - Source.TXT: ASCII text, with CRLF line terminators
20150728 - Source Fragment 3 copy.TXT: ASCII text
I'm a bit "stuck" on what the issue might be. I have the feeling it's one of those "Obscure Mac Quirks" that are very hard to explain.
EDIT: As per the comments below from @user3439894 and others, I've looked into the extended attributes of the files to see if that yields any hint.
The output of ls -l@
for the files gives us:
-rw-r--r--@ 1 jjarava staff 7652 Aug 3 13:58 20150728 - Source Fragment 3 (BAD).TXT
com.apple.FinderInfo 32
com.apple.TextEncoding 15
com.dropbox.attributes 83
-rw-r--r--@ 1 jjarava staff 6570 Aug 3 13:58 20150728 - Source Fragment 1 (Good).TXT
com.apple.FinderInfo 32
com.apple.TextEncoding 15
com.dropbox.attributes 83
-rw-r--r--@ 1 jjarava staff 6616 Aug 3 13:58 20150728 - Source Fragment 2 (Good).TXT
com.apple.FinderInfo 32
com.apple.TextEncoding 15
com.dropbox.attributes 83
-rw-r--r--@ 1 jjarava staff 21138 Aug 3 13:58 20150728 - Source (BAD).TXT
com.apple.FinderInfo 32
com.dropbox.attributes 83
Again, I see that one of the bad files (Source) is apparently missing the com.apple.TextEncoding
attribute -- but the other "not working" file does have the attribute... Just in case the values are different for the good and bad files, let's check:
Mac:samples jjarava$ xattr -p com.apple.TextEncoding 201507*txt
20150728 - Source Fragment 3 (BAD).TXT: UTF-8;134217984
Source Fragment 1 (Good).TXT: UTF-8;134217984
Source Fragment 2 (Good).TXT: UTF-8;134217984
xattr: 20150728 - Source (BAD).TXT: No such xattr: com.apple.TextEncoding
So that doesn't seem to be the trick either...
20150728 - Source.TXT: ASCII text, with CRLF line terminators
. Try replacing the CRLF line terminators with just LF. In a Terminal, try:tr -d '\r' < input.file > output.file
Source
to makeSource 3
I made sure the line endings were "Unix" in TextWrangler. As you can see the other non-working files areLF
file
already showed that, however the layout it what I'm interested, how is it delimitated? And what is thels -l@
output for the greyed out files?