A line-oriented file editor for LLM-assisted coding
- ✓Open-source license (MIT)
- ✓Clear description
- ✓Topics declared
- ✓Documented (README)
git clone https://github.com/amalexico/feditTools overview
# fedit — Fast File Editor for the Terminal
[](https://ko-fi.com/fedit)
[](https://opencollective.com/fedit)
A zero-dependency CLI tool for **surgical file edits** from the command line.
No interactive editors. No sed/awk gymnastics. Just simple, predictable operations
with built-in verification.
Built for sysadmins, DevOps engineers, and anyone who scripts config changes.

```
go install github.com/amalexico/fedit@latest
```
---
## Why fedit?
- **One binary, zero dependencies** — pure Go, runs everywhere
- **17 language mappers** — see the structure of any file before editing
- **-v flag** — verify every mutation before moving on
- **Line-aware** — no regex surprises, no "which match did it hit?"
- **Stream engine** — process multi-GB files line-by-line with atomic integrity
- **Field extraction** — pull CSV/TSV column N without awk
- **Safe** — no in-place unless you say so, never touches files you did not name
---
## Install
**Go install (recommended):**
```bash
go install github.com/amalexico/fedit@latest
```
Or download the binary from [GitHub Releases](https://github.com/amalexico/fedit/releases) and put it in your PATH.
**Verify:**
```bash
fedit -file /etc/hostname -op show
```
---
## Quick Start
```bash
# See what is in a file
fedit -file config.yaml -op show
# See just lines 10-25
fedit -file config.yaml -op show -line 10 -end 25
# Find every line containing "timeout"
fedit -file config.yaml -op find -match "timeout"
# See the structure of a Go file
fedit -file main.go -op map -lang go
# Replace line 42 with new content
fedit -file config.yaml -op replace -line 42 -end 42 -text "timeout: 60s" -v
# Insert a line after every occurrence of "server {"
fedit -file nginx.conf -op insertafter -match "server {" -text " include security.conf;" -v
# Move a function block before another (content-matched, atomic)
fedit -file main.go -op move -match "func OldHelper(" -end 45 -beforematch "func NewHelper(" -v
# Copy a config block and paste it 3 times at a new location
fedit -file values.yaml -op copy -line 50 -end 65 -after 200 -times 3 -v
# Extract column 2 from a TSV file (v1.4+)
fedit -file data.tsv -op fields -col 2
# Write content with literal backslashes — no \n escape expansion (v1.6.0)
fedit -file config.txt -op writeraw -text "path=C:\\Users\\admin"
# Hex-encode tricky text to sidestep shell quoting (v1.6.0)
# fwencode produces the hex; fedit decodes it before writing
fedit -file config.txt -op write -texthex 706174683d2f746d70
# Overwrite a file cleanly then insert new content (v1.6.0)
fedit -file config.txt -op insert -line 0 -cleanfirst -text "# regenerated"
# Get bare line numbers for scripting (v1.6.0)
fedit -file main.go -op find -match "TODO" -x 2>$null
# Regex replace on a multi-GB log without loading it into memory (v1.4+)
fedit -file huge.log -op replaceall -match 'ERROR' -text 'WARN' -stream
```
---
## All Operations
### show — Display file contents
```bash
# Entire file
fedit -file app.conf -op show
# Lines 50-75 only
fedit -file app.conf -op show -line 50 -end 75
# Last 10 lines
fedit -file app.conf -op show -line -10:
# Lines 50 to 5th from end
fedit -file app.conf -op show -line 50 -end -5
# Lines 100-103 (relative range)
fedit -file app.conf -op show -line 100:+3
# Show from one anchor to another (no line numbers needed)
fedit -file config.go -op show -match "func Start" -endmatch "func End"
```
---
### find — Search for lines matching a substring
```bash
# Find all lines containing "ERROR"
fedit -file /var/log/app.log -op find -match "ERROR"
# Output includes context lines and occurrence numbers
# Use -nth to target a specific match in other operations
```
**Pro tip:** Run find first to get line numbers, then use replace or delete with exact lines.
---
### insert — Insert content after a line number
```bash
# Insert a comment after line 1
fedit -file script.sh -op insert -line 1 -text "# Added by deploy script" -v
# Insert multiple lines from a file
fedit -file config.yaml -op insert -line 10 -textfile extra-config.yaml -v
```
---
### insertafter — Insert after a matching line (RECOMMENDED)
```bash
# Add a firewall rule after the matching comment
fedit -file iptables.rules -op insertafter -match "# Custom rules" -text "-A INPUT -p tcp --dport 8080 -j ACCEPT" -v
# Target the 2nd occurrence
fedit -file nginx.conf -op insertafter -match "server {" -nth 2 -text " listen 8443 ssl;" -v
# Target the last occurrence
fedit -file docker-compose.yml -op insertafter -match "volumes:" -nth -1 -text " - /data:/data" -v
```
---
### insertbefore — Insert before a matching line (RECOMMENDED)
```bash
# Add a header before the first route definition
fedit -file routes.rb -op insertbefore -match "get '/'" -text " # === Public Routes ===" -v
# Insert a dependency before the closing bracket
fedit -file package.json -op insertbefore -match "}" -nth -1 -textfile new-deps.txt -v
```
---
### replace — Replace a line range with new content
```bash
# Replace a single line
fedit -file config.ini -op replace -line 15 -end 15 -text "max_connections = 200" -v
# Replace lines 30-35 with content from a patch file
fedit -file server.conf -op replace -line 30 -end 35 -textfile patched-block.txt -v
# Replace a section by content anchors (no line numbers needed)
fedit -file CHANGELOG.md -op replace -match "## v1.6" -endmatch "## v1.5" -textfile new-section.txt -v
```
---
### replaceall — Global find-and-replace
```bash
# Change all occurrences of old domain to new
fedit -file nginx.conf -op replaceall -match "old.example.com" -text "new.example.com" -v
# Update a version string everywhere
fedit -file Makefile -op replaceall -match "1.1.0" -text "1.2.0" -v
---
### fields -- Extract a column from delimited files (v1.4.0)
```bash
# Extract column 2 from a tab-separated file (default delimiter: tab)
fedit -file data.tsv -op fields -col 2
# Extract the third field from a CSV
fedit -file report.csv -op fields -col 3 -delim ","
# Extract usernames from /etc/passwd (colon-delimited)
fedit -file /etc/passwd -op fields -col 1 -delim ":"
```
Output goes to stdout for piping. Lines shorter than `-col` are skipped silently.
Always streaming -- no memory limit regardless of file size.
### -stream -- Large-file streaming mode (v1.4.0)
Add `-stream` to `replaceall` or `find` to process files line-by-line without
loading them into memory. 10 MB per-line buffer handles JSON blobs and minified files.
Atomic integrity: writes to a temp file then renames -- original is untouched on interruption.
```bash
# Replace a pattern in a multi-GB log file
fedit -file server.log -op replaceall -match "10.0.0.1" -text "10.0.0.2" -stream
# Regex replace in a huge file with capture groups
fedit -file big.csv -op replaceall -match-regex 'id_(\d+)' -text 'ID_$1' -stream
# Streaming find -- grep-style output to stdout
fedit -file huge.log -op find -match "FATAL" -stream
```
Supported with `-stream`: `replaceall` (literal and regex), `find`.
Not supported: `move`, `copy`, `map` (these require full file structure in memory).
### writeraw — Write without escape expansion
```bash
# Write a Windows path without double-escaping backslashes
fedit -file config.ini -op writeraw -text "basedir=C:\\Program Files\\App"
# Write content from a file as-is
fedit -file output.txt -op writeraw -textfile template.txt
```
Unlike `write`, `writeraw` treats `\n` as two characters (backslash + n), not a newline.
---
### writelines — Write lines interactively from stdin
```bash
fedit -file notes.txt -op writelines
# Type lines at the > prompt, Ctrl+Z (Windows) or Ctrl+D (Unix) to finish
```
---
### -texthex — Hex-encoded input (v1.6.0)
Encode text to hex first (e.g. with `fwencode`), then pass the hex string as `-text`.
Eliminates all shell-quoting issues with special characters.
```bash
# Decode hex string and write — no quoting gymnastics needed
fedit -file deploy.sh -op write -texthex 23212f62696e2f62617368
```
---
### -cleanfirst — Truncate before writing (v1.6.0)
```bash
# Clear the file then insert fresh content at line 0
fedit -file output.txt -op insert -line 0 -cleanfirst -text "# regenerated"
```
---
### -x — Machine-readable output (v1.6.0)
```bash
# Get bare line numbers from find (stdout only, no context noise)
fedit -file main.go -op find -match "TODO" -x 2>$null
# Extract CSV column with no stats footer
fedit -file data.csv -op fields -col 2 -delim "," -x
```
---
#### v1.5.0: HCL/Terraform block mapper (`-lang hcl`)
Move, copy, and refactor Terraform blocks by name — no line numbers needed.
Accepts `-lang hcl`, `-lang tf`, or `-lang terraform` (all equivalent).
Supported block types: `resource`, `data`, `module`, `provider`, `variable`,
`output`, `locals`, `terraform`, `moved`, `import`, `check`.
```bash
# Move a resource block before another
fedit -file main.tf -op move -block 'resource "aws_instance" "web"' \
-beforeblock 'resource "aws_s3_bucket" "data"' -lang hcl -v
# Copy a variable definition (scaffold new variable from existing)
fedit -file variables.tf -op copy -block 'variable "instance_type"' \
-after 20 -lang hcl -v
# Reorder provider blocks
fedit -file providers.tf -op move -block 'provider "google"' \
-beforeblock 'provider "aws"' -lang hcl -v
```
Nested blocks (e.g. `ingress {}` inside a `resource`) are correctly ignored —
only top-level blocks are matched.
#### v1.5.0: Nix block mapper (`-lang nix`)
Move and copy top-level attribute bindings in Nix expression files.
Handles attribute sets (`name = { }`), lists (`name = [ ]`), and
dotted attributes (`programs.git = { }`).
```bash
# Reorder home-manager program configs
fedit -file home.nix -op move -block "programs.git" \
-beforeblock "programs.ssh" -lang nix -v
# Copy a service config asWhat people ask about fedit
What is amalexico/fedit?
+
amalexico/fedit is tools for the Claude AI ecosystem. A line-oriented file editor for LLM-assisted coding It has 11 GitHub stars and its last recorded update is dated 2026-06-18.
How do I install fedit?
+
You can install fedit by cloning the repository (https://github.com/amalexico/fedit) or following the README instructions on GitHub. ClaudeWave also provides quick install blocks on this page.
Is amalexico/fedit safe to use?
+
Our security agent has analyzed amalexico/fedit and assigned a Trust Score of 85/100 (tier: Trusted). See the full breakdown of passed checks and flags on this page.
Who maintains amalexico/fedit?
+
amalexico/fedit is maintained by amalexico. The last recorded GitHub activity is dated 2026-06-18, with 0 open issues.
Are there alternatives to fedit?
+
Yes. On ClaudeWave you can browse similar tools at /categories/tools, sorted by popularity or recent activity.
Deploy fedit to your cloud
Ship this repo to production in minutes. Each platform spins up its own environment with editable env vars.
Maintain this repo? Add a badge to your README
Drop the badge into your GitHub README to show it's tracked on ClaudeWave. Each badge links back to this page and reflects the live Trust Score.
[](https://claudewave.com/repo/amalexico-fedit)<a href="https://claudewave.com/repo/amalexico-fedit"><img src="https://claudewave.com/api/badge/amalexico-fedit" alt="Featured on ClaudeWave: amalexico/fedit" width="320" height="64" /></a>More Tools
A single CLAUDE.md file to improve Claude Code behavior, derived from Andrej Karpathy's observations on LLM coding pitfalls.
An AI skill that provides design intelligence for building professional UI/UX across multiple platforms.
🪨 why use many token when few token do trick. Viral skill + proxy for coding agents that cuts 65% of tokens by talking like a caveman.
CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies
The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Use Claude Code, Codex, Pi, and OpenCode (and 6 other harnesses) for free (1.3B+ free tokens) from your terminal, app, IDE, or phone, and now from the browser with native browser sessions (multi-harness + multi-model) like OpenClaw (voice supported + ToS friendly)