Workspace is a tool suite for file operations, version management, and development workflow automation. Includes refac (string replacement), scrap (local trash folder), unscrap (file restoration), and st8 (automatic versioning).
ldiff
is a line difference visualizer that processes input lines, replacing repeated tokens with a substitute character for easy pattern recognition. It’s particularly useful for analyzing log files, command output, and any text with recurring patterns.
ldiff
reads input line by line and compares each line to the previous one. When it finds tokens (words, numbers) that repeat from the previous line, it replaces them with a substitute character, making unique content stand out.
The tool recognizes several types of tokens:
hello
, world
, API
)2023
, 404
, 127
):
, -
, /
, @
, etc.)While replacing repeated tokens, ldiff
carefully preserves:
Hello
and hello
are different tokens# Read from stdin with default substitute character (░)
echo -e "hello world\nhello universe" | ldiff
# Output:
# hello world
# ░░░░░ universe
# Use a custom character for substitution
echo -e "test line\ntest another" | ldiff "*"
# Output:
# test line
# **** another
# Process a file
ldiff < input.txt
# Process compressed logs
gunzip -c app.log.gz | ldiff
# Use with other commands
cat /var/log/system.log | tail -n 100 | ldiff
# Analyze system logs for patterns
tail -f /var/log/syslog | ldiff
# Find repeated patterns in auth logs
grep "Failed password" /var/log/auth.log | ldiff
# Monitor application logs in real-time
tail -f /var/log/myapp.log | ldiff
# Analyze historical logs
cat /var/log/myapp.log.1 | ldiff > patterns.txt
# Analyze access patterns
cat /var/log/nginx/access.log | ldiff "■"
# Find common request patterns
awk '{print $7}' /var/log/apache2/access.log | sort | ldiff
# Input log lines:
# 2023-01-01 10:00:00 INFO Starting application
# 2023-01-01 10:00:01 INFO Loading configuration
# 2023-01-01 10:00:02 ERROR Failed to connect
cat app.log | ldiff
# Output:
# 2023-01-01 10:00:00 INFO Starting application
# ░░░░-░░-░░ ░░:░░:01 ░░░░ Loading configuration
# ░░░░-░░-░░ ░░:░░:02 ERROR Failed to connect
# Analyze directory structures
find /usr/local -type f | ldiff
# Compare file paths
ls -la /usr/bin/ | ldiff "●"
# Analyze running processes
ps aux | ldiff
# Monitor process changes
watch -n 1 "ps aux | head -20" | ldiff
# Analyze network connections
netstat -tulpn | ldiff
# Monitor network activity
ss -tulpn | ldiff "█"
# Use Unicode characters for substitution
echo -e "hello world\nhello universe" | ldiff "█"
echo -e "test line\ntest another" | ldiff "▓"
echo -e "data point\ndata value" | ldiff "◆"
# Save patterns to file
cat large.log | ldiff > patterns.txt
# Combine with other tools
cat access.log | grep "GET" | ldiff | head -50
# Chain multiple filters
journalctl -f | grep "ERROR" | ldiff "*" | tee error_patterns.log
# Monitor multiple log sources
tail -f /var/log/app1.log /var/log/app2.log | ldiff
# Monitor system activity
dmesg -w | ldiff
# Watch command output
watch -n 2 "df -h" | ldiff
# 1. Start monitoring your application logs
tail -f /var/log/myapp.log | ldiff &
# 2. Reproduce the issue
./trigger_bug.sh
# 3. Analyze the pattern differences
# Repeated timestamp/process info is masked, errors stand out
# 4. Save interesting patterns
pkill tail
cat /var/log/myapp.log | tail -100 | ldiff > debug_patterns.txt
# 1. Monitor system health
tail -f /var/log/syslog | ldiff "■" &
# 2. Check for unusual patterns
# Normal startup messages will show patterns
# Anomalies will show unique content
# 3. Investigate specific issues
grep "$(date +%Y-%m-%d)" /var/log/syslog | ldiff
# 1. Capture performance data
top -b -n 10 | ldiff > perf_patterns.txt
# 2. Analyze patterns
cat perf_patterns.txt | grep -v "░"
# 3. Find anomalies
# Look for lines without substitute characters
ldiff
automatically handles various timestamp formats:
# ISO 8601: 2023-01-01T10:00:00Z
# Syslog: Jan 01 10:00:00
# Apache: [01/Jan/2023:10:00:00 +0000]
# Custom: 2023-01-01 10:00:00.123
The tool recognizes these separator patterns:
/usr/local/bin
→ /░░░/░░░░░/bin
https://api.example.com
→ ░░░░░://░░░.░░░░░░░.com
user@domain.com
→ ░░░░@░░░░░░.com
192.168.1.100
→ ░░░.░░░.░.░░░
# Filter then analyze patterns
grep "ERROR" /var/log/app.log | ldiff
# Extract specific fields then analyze
awk '{print $1, $7}' /var/log/access.log | ldiff
# Find unique patterns
cat /var/log/app.log | ldiff | sort | uniq -c
# Analyze recent entries
tail -100 /var/log/app.log | ldiff
# Check first patterns
head -50 /var/log/app.log | ldiff
head
, less
, etc.tail
or head
for very large files-f
flag with tail
for live monitoringgrep
, awk
, and other text tools# Monitor failed login attempts
tail -f /var/log/auth.log | grep "Failed" | ldiff
# Analyze access patterns
cat /var/log/nginx/access.log | ldiff | grep -v "░"
# Track API response patterns
tail -f /var/log/api.log | grep "response_time" | ldiff
# Monitor database queries
tail -f /var/log/mysql/slow.log | ldiff
# Analyze process startup patterns
dmesg | grep "systemd" | ldiff
# Monitor resource usage patterns
vmstat 1 | ldiff