Comprehensive text processing utilities for filtering, searching, formatting, and transforming text data. These tools provide powerful text manipulation capabilities within the WebAssembly environment.
Search for patterns in text using regular expressions and fixed strings.
/**
* Search for patterns in text
* WebAssembly binary: dist/wasm/bin/grep
*
* Usage patterns:
* - grep [options] pattern [file...]
* - Supports -i (case insensitive), -v (invert match), -n (line numbers)
* - Regular expression and fixed string matching
*/Display portions of text files from beginning or end.
/**
* Display first lines of files
* WebAssembly binary: dist/wasm/bin/head
*
* Usage patterns:
* - head [options] [file...]
* - Default shows first 10 lines
* - Supports -n (number of lines), -c (number of bytes)
*//**
* Display last lines of files
* WebAssembly binary: dist/wasm/bin/tail
*
* Usage patterns:
* - tail [options] [file...]
* - Default shows last 10 lines
* - Supports -n (number of lines), -c (number of bytes)
* - Note: tail -f (follow) not supported in WebAssembly
*/Extract specific columns or fields from text.
/**
* Extract columns from text
* WebAssembly binary: dist/wasm/bin/cut
*
* Usage patterns:
* - cut [options] [file...]
* - Supports -f (fields), -c (characters), -d (delimiter)
* - Perfect for CSV and structured text processing
*/Sort lines of text with various ordering options.
/**
* Sort lines of text
* WebAssembly binary: dist/wasm/bin/sort
*
* Usage patterns:
* - sort [options] [file...]
* - Supports -n (numeric), -r (reverse), -u (unique)
* - Custom field and key-based sorting
*/Report or omit repeated lines in sorted text.
/**
* Report or omit repeated lines
* WebAssembly binary: dist/wasm/bin/uniq
*
* Usage patterns:
* - uniq [options] [input [output]]
* - Supports -c (count), -d (duplicates only), -u (unique only)
* - Works on adjacent duplicate lines (use with sort)
*/Count lines, words, characters, and bytes in text.
/**
* Count lines, words, and characters
* WebAssembly binary: dist/wasm/bin/wc
*
* Usage patterns:
* - wc [options] [file...]
* - Supports -l (lines), -w (words), -c (characters), -m (multibyte chars)
* - Default shows lines, words, and characters
*/Translate or delete characters in text.
/**
* Translate or delete characters
* WebAssembly binary: dist/wasm/bin/tr
*
* Usage patterns:
* - tr [options] set1 [set2]
* - Supports -d (delete), -s (squeeze), -c (complement)
* - Character class support like [:alpha:], [:digit:]
*/Format text paragraphs and handle spacing.
/**
* Format text paragraphs
* WebAssembly binary: dist/wasm/bin/fmt
*
* Usage patterns:
* - fmt [options] [file...]
* - Supports -w (width), -g (goal width), -s (split long lines only)
* - Reformats paragraphs to specified width
*//**
* Wrap text lines to specified width
* WebAssembly binary: dist/wasm/bin/fold
*
* Usage patterns:
* - fold [options] [file...]
* - Supports -w (width), -s (break at spaces), -b (count bytes)
* - Note: File input mode has known issues
*/Convert between spaces and tabs.
/**
* Convert tabs to spaces
* WebAssembly binary: dist/wasm/bin/expand
*
* Usage patterns:
* - expand [options] [file...]
* - Supports -t (tab stops), custom tab spacing
* - Note: File input mode has known issues
*//**
* Convert spaces to tabs
* WebAssembly binary: dist/wasm/bin/unexpand
*
* Usage patterns:
* - unexpand [options] [file...]
* - Supports -t (tab stops), -a (all spaces)
* - Inverse operation of expand
*/Add line numbers to text output.
/**
* Number lines in text
* WebAssembly binary: dist/wasm/bin/nl
*
* Usage patterns:
* - nl [options] [file...]
* - Supports -b (body numbering), -n (number format), -s (separator)
* - Note: File input mode has known issues
*/Merge lines from multiple files in various ways.
/**
* Merge lines from files side by side
* WebAssembly binary: dist/wasm/bin/paste
*
* Usage patterns:
* - paste [options] [file...]
* - Supports -d (delimiters), -s (serial merge)
* - Combines corresponding lines from files
*//**
* Join lines from two sorted files
* WebAssembly binary: dist/wasm/bin/join
*
* Usage patterns:
* - join [options] file1 file2
* - Supports -1/-2 (join fields), -t (field separator)
* - Database-style join operation on text files
*/Compare sorted files line by line.
/**
* Compare sorted files line by line
* WebAssembly binary: dist/wasm/bin/comm
*
* Usage patterns:
* - comm [options] file1 file2
* - Supports -1/-2/-3 (suppress columns)
* - Shows unique and common lines in three columns
*/Split files based on context patterns.
/**
* Split files based on context
* WebAssembly binary: dist/wasm/bin/csplit
*
* Usage patterns:
* - csplit [options] file pattern...
* - Supports regular expressions and line numbers
* - Creates multiple output files based on patterns
*/Text analysis pipeline:
# Count unique words in a file (would be executed via WASM runtime)
cat document.txt | tr ' ' '\n' | sort | uniq -c | sort -nrData processing:
# Extract and sort email addresses from CSV
cut -d',' -f3 users.csv | sort | uniqText formatting:
# Format text to 80 columns
fmt -w 80 long_document.txtPattern matching:
# Find lines containing error patterns
grep -i "error\|warning\|fail" logfile.txtgrep → cut → sort → uniq -ccut → tr → sorttr → fold → fmtsort → comm or joinwc → custom processing