mne_bids.search_folder_for_text

mne_bids.search_folder_for_text(entry, folder, extensions=('.json', '.tsv'), line_numbers=True, return_str=False)[source]

Find any particular string entry in the text files of a folder.

Note

This is a search function like grep that is formatted nicely for BIDS datasets.

Parameters
entrystr

The string to search for

folderpath-like

The folder in which to search.

extensionslist | tuple | str

The extensions to search through. Default is json and tsv which are the BIDS sidecar file types.

line_numbersbool

Whether to include line numbers.

return_strbool

If True, return the fields with “n/a” as a str instead of printing them.

Returns
str | None

If return_str is True, the fields are returned as a string. Else, None is returned and the fields are printed.

Examples using mne_bids.search_folder_for_text