18. Text search

 

17. Large join query

Search a given file folder for all txt files containing text BEIJING and list the numbr of row it is located and the corresponding text.

Expected result:

SPL code:

A
1 =directory@p(“*.txt”)
2 =A1.conj(file(~).read@n().(if(pos(~,“BEIJING”),[A1.~,#,~].concat@c())).select(~))

In A1, directory() function searches for file names matching parameter path, the wildcard path, and works with @p option to return a full path for the convenience of data retrieval. A2 searches A1’s file list by reading data from every file line by line, and records file names, number of the eligible row and correpsonding text in the row if text BEIJING is found. A.conj() function concatenates results consisting of required information of eligible files into a sequence.


19. Password strength-related analysis
Contents and Exercise Data