One way using my previous code: julia> find(x->contains(x,"ap"),a) 2-element Array{Int64,1}: 1 3
julia> find(x->contains(x,"ar"),a) 2-element Array{Int64,1}: 2 4 On Thursday, December 3, 2015 at 1:24:07 PM UTC-8, Jason McConochie wrote: > > Thank you to all. In particular, how can the indices of the matching > lines be returned - I've a matlab background so am used to working from the > indices. > > > On Thursday, December 3, 2015 at 8:52:34 PM UTC+1, Jason McConochie wrote: >> >> Is there grep for an Array of AbstractStrings? See code below >> >> >> # A. Read a file into memory (nLines pre-determined) >> >> fID=open(fName) >> >> iLine=0; >> >> rLines=Array(ASCIIString,nLines); >> >> while !eof(fID) >> >> iLine+=1 >> >> rLines[iLine]=readline(fID) >> >> end >> >> >> # B. Find all strings in rLines with "parameter" >> >> ???? Is something like this possible? >> >> indices=grep(rLines,r"parameter") >> >> >> >>