I would like to define a file type that would enable me to ignore all files without extension in ack. In my .ackrc file I have added:
--type-set=csv:ext:csv,tsv
To handle CSV files that I often exclude from searches via --nocsv switch when running ack query. However, some of the files I would like to exclude have no CSV extension. Ideally, I would like to be able to arrive at a syntax:
ack --nocsv --nosansext searchStuff ~/SomeProjects
I would like for this command to:
- Exclude CSV files
- Exclude files without extension
- Include all other syntax files that I have in
SomeProjectsfolder.
Is it possible to define a file type in ack to capture files without extension?
--type-add 'csv:match:/^[^.]+$/'. – Satō Katsura May 11 '17 at 11:32ack --nocsv --type-add 'csv:match:/^[^.]+$/' searchPhrase ~/worked as desired, would you care to explain how the'csv:match:/^[^.]+$/'works? – Konrad May 11 '17 at 11:45ext:is,match, andfirstlinematch.isandmatchmatch against filename,firstlinematchmatches against the first line of the file. So--type-add 'csv:match:/^[^.]+$/'adds files without extension to thecsvtype. All straight from the manual, section "Defining your own types". – Satō Katsura May 11 '17 at 15:22