Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Command line tool to filter text and save result to file or print to output!
Explore the docs »
Report Bug
·
Request Feature
text_filter.py is a simple commandline tool to filter text using predefined filters and save the result in a new file.
You can use it for:
This is a simple command line tool written in native python 3, no additional dependencies.
Complete list of dependencies:
Python 3.x |
Install via pip:
pip install filtertext
pip will install a command line script that you can use. To find the installation directory of that script, you can run this code:
python -m site --user-base
Inside of that folder, you will find a folder structure similar to Python312\Scripts
or Python312\bin
.
In this folder, there is a script file filter_text.py
.
You can add this folder (../Scripts
or ../bin
) to your environment variables,
so you can run the script without navigating to the folder again.
You can run the script filter_text.py with some command line arguments:
filter_text.py [-h] [-w] [-d] [-l LIST_FILE] [-D OUTPUT_PATH] [-o OUTPUT_FILE] FILE [FILE ...]
Filter
-w Remove lines that only contain whitespace
-d Remove duplicate lines
Input
FILE: files to filter
-f LIST_FILE: Input file with list of files to filter, one file per line
Output
-D OUTPUT_PATH: Output directory (if it exists, it will be deleted first)
-o OUTPUT_FILE: Output file path (if it exists, it will be deleted first)
For more examples, please refer to the Documentation
from filtertext import *
file_path = "example.txt"
remove_whitespace = RemoveWhitespaceLinesTextFilter.from_file(file_path)
remove_whitespace.filter()
print(remove_filter.text)
For more examples, please refer to the Documentation
Thank you for your interest in contributing! Any contributions you make are greatly appreciated.
Please make sure to follow our Code of Conduct.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue, if you prefer. Don't forget to give the project a star! Thanks again!
git checkout -b feature/AmazingFeature
)git commit -m 'Add some AmazingFeature'
)git push origin feature/AmazingFeature
)Copyright 2024 Micha Grandel
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
See LICENSE.md for more information.
Project Link: https://github.com/michagrandel/filtertext
FAQs
Filter text and save result to file or print to output!
We found that filtertext demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.