If you want to stay in Julia, you can also use:       

filter(r".*\.txt",readdir())

Ivar

kl. 12:06:44 UTC+1 onsdag 19. februar 2014 skrev Roger Herikstad følgende:
>
> Hi,
>  Thanks for the quick reply! I didn't occur to me that the shell was doing 
> the expansion in this case; thanks for clearing that up. I'll just go ahead 
> and use find for now; that works fine for my purpose. 
>
> On Wednesday, February 19, 2014 7:00:11 PM UTC+8, Ivar Nesje wrote:
>>
>> Julia does not use a shell to expand commands when you input with 
>> backticks and `ls` does not match patterns. You can use run(`find . -d 1 
>> -name *.txt`) to use a program that does not depend on the shell to do the 
>> pattern matching.
>>
>> See how echo * works to see that it is the shell who does the expansion, 
>> and not ls.
>>
>> Ivar
>>
>> kl. 11:27:22 UTC+1 onsdag 19. februar 2014 skrev Roger Herikstad følgende:
>>>
>>> Hi,
>>>  I'm a bit surprised that this doesn't work
>>>
>>>
>>> _       _ _(_)_     |  A fresh approach to technical computing
>>>   (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
>>>    _ _   _| |_  __ _   |  Type "help()" to list help topics
>>>   | | | | | | |/ _` |  |
>>>   | | |_| | | | (_| |  |  Version 0.2.0 (2013-11-16 23:44 UTC)
>>>  _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org release
>>> |__/                   |  x86_64-apple-darwin12.5.0
>>>
>>> julia> ;ls
>>> file1.txt file2.txt file3.txt file4.txt file5.txt
>>>
>>> julia> ;ls *.txt
>>> file1.txt file2.txt file3.txt file4.txt file5.txt
>>>
>>> julia> run(`ls *.txt`)
>>> ls: *.txt: No such file or directory
>>> ERROR: failed process: Process(`ls *.txt`, ProcessExited(1)) [1]
>>>  in pipeline_error at process.jl:476
>>>  in run at process.jl:453
>>>
>>>
>>> How do I use wildcards in conjunction with run(`ls ..`)? I am trying get 
>>> a list of files matching a certain pattern that I will then do some 
>>> processing on. In other words, I would like to do something like this:
>>>
>>> files = readall(`ls file*.txt`)
>>>
>>>
>>>  
>>>
>>>  
>>>
>>>

Reply via email to