__freadable - Linux
Overview
__freadable is a powerful Linux utility that enhances the readability of text files by applying various transformations and formatting options. It’s ideal for working with complex or difficult-to-read text data.
Syntax
__freadable [OPTIONS] FILE [OUTPUT]
Options/Flags
- -d, –decode: Decodes HTML or URL-encoded characters.
- -e, –expand-tabs: Expands tabs into spaces.
- -i, –indent: Indents lines with two spaces.
- -l, –line-breaks: Ensures that lines contain proper line breaks.
- -m, –markdown: Converts plain text to Markdown format.
- -n, –number-lines: Numbers the lines of the text.
- -o, –output
- -s, –strip: Strips leading and trailing whitespace.
- -t, –tabs: Converts spaces into tabs.
- -w, –width: Sets the maximum line width. Default: 80 characters.
- -h, –help: Displays help information.
- -v, –version: Displays the version information.
Examples
Convert plain text to Markdown format
__freadable -m my_text.txt my_markdown.md
Number lines and strip whitespace
__freadable -n -s my_complex_text.txt
Expand tabs and limit line width
__freadable -e -w 60 my_code.txt
Common Issues
File doesn’t exist
Ensure that the specified file path is correct.
Output file not created
Verify that the output file has write permissions.
Integration
__freadable can be combined with other Linux tools for advanced tasks:
- Pipe the output of grep to __freadable to filter and format search results.
- Use __freadable to prepare text data for parsing by other scripts or programs.
Related Commands
- less
- more
- sed
- awk