FQL (File Query Language) is a simple and powerful file querying language designed to help you efficiently search and extract information from text files. Whether you need to analyze log files, parse JSON, or extract specific content from text files, FQL provides a versatile set of commands to simplify the process.
- Introduction
- Basic Queries
- Searching
- Counting
- Compiler Binaries
- License
- Issues and Pull Requests
- Contributing
FQL - File Query Language is a versatile tool for querying text files, providing a range of capabilities to efficiently work with textual data. With FQL, you can perform tasks such as extracting lines, counting words, and searching for specific content within your files. Whether you're a developer, data analyst, or system administrator, FQL simplifies the process of working with text files.
The SELECT
statement is used to retrieve content (lines) from a file. You specify the file path within double quotes. For example:
SELECT * FROM "C:\temp\workflow2.json";
The SELECT TOP
statement allows you to select a specific number of lines from the beginning of the file. Replace 15
with the desired number of lines:
SELECT TOP(15) FROM "C:\temp\workflow2.json";
The SELECT TAIL
statement lets you select a specific number of lines from the end of the file. Replace 15
with the desired number of lines:
SELECT TAIL(15) FROM "C:\temp\workflow2.json";
Use the SELECT WHERE LIKE
statement to find lines containing a particular phrase. Replace "contains this word"
with your desired phrase:
SELECT * FROM "C:\temp\workflow2.json" WHERE LIKE "contains this word";
The SELECT WHERE NOTLIKE
statement helps you find lines that do not contain a specific phrase. Replace "contains this word"
with the phrase you want to exclude:
SELECT * FROM "C:\temp\workflow2.json" WHERE NOTLIKE "contains this word";
The SELECT WHERE REGEX
statement helps you find lines that do match a specific RegularExpression. Replace "RegexPattern"
with the RegEx you want to compile and use for searching:
SELECT * FROM "C:\temp\workflow2.json" WHERE REGEX "RegexPattern";
To count the total number of lines in a file, use the SELECT COUNTL
statement:
SELECT COUNTL * FROM "C:\temp\workflow2.json"; //return count of all Lines in this file...
SELECT COUNTL TOP(20) FROM "C:\temp\workflow2.json"; // return count of lines from the top 20 lines of the file
To count the number of words (space-separated) in a file, use the SELECT COUNTW
statement:
SELECT COUNTW * FROM "C:\temp\workflow2.json"; //return count of words from the entire file
SELECT COUNTW TOP(20) FROM "C:\temp\workflow2.json"; // return count of words from the top 20 lines of the file
The SELECT COUNTC
statement allows you to count the total number of characters in a file:
SELECT COUNTC * FROM "C:\temp\workflow2.json"; //return count of characters from the entire file
SELECT COUNTC TOP(20) FROM "C:\temp\workflow2.json"; // return count of characters from the top 20 lines of the file
You can download the FQL compiler binaries from the "bin" folder of this repository.
FQL is licensed under the MIT License and the Apache 2.0 License.
If you encounter issues or have suggestions for improvement, please feel free to open an issue or create a pull request.
Contributions are welcome! Read the Contributing Guidelines to get started.
FQL simplifies the process of working with text files, making it easier to extract information and perform various operations on textual data. Whether you need to extract specific lines, count words, or search for phrases, FQL's intuitive syntax helps you achieve your goals efficiently.