<< All versions
Skill v1.0.0
currentAutomated scan93/100everfern-ai/everfern/txt
──Details
PublishedSeptember 29, 2026 at 09:20 PM
Content Hashsha256:46c216d58063a4ec...
Git SHA
──Files
Files (1 file, 5.6 KB)
SKILL.md5.6 KBactive
SKILL.md · 230 lines · 5.6 KB
version: "1.0.0" name: txt description: "Use this skill any time a text file (.txt) is the primary input or output. This includes tasks to: read, analyze, search, transform, or create plain text files; extract text patterns; process logs; create reports; manipulate text content. If the user mentions a text file or .txt path, use this skill."
Text File Handling in EverFern
Overview
Users may ask you to read, analyze, create, or modify text files. Use Python's file operations for reading/writing text on Windows with absolute paths (e.g., C:\Users\Username\Downloads\data.txt).
Reading Text Files
Read Entire File
python
# Read all contentwith open(r'C:\path\to\file.txt', 'r', encoding='utf-8') as f:content = f.read()print(content)# Read line by linewith open(r'C:\path\to\file.txt', 'r', encoding='utf-8') as f:for line in f:print(line.strip())# Read into listwith open(r'C:\path\to\file.txt', 'r', encoding='utf-8') as f:lines = f.readlines()print(f"Total lines: {len(lines)}")
Writing Text Files
Create or Overwrite File
python
content = "Hello, World!\nLine 2\nLine 3"with open(r'C:\path\to\output.txt', 'w', encoding='utf-8') as f:f.write(content)
Append to File
python
with open(r'C:\path\to\file.txt', 'a', encoding='utf-8') as f:f.write("\nNew line appended")
Write Multiple Lines
python
lines = ["Line 1","Line 2","Line 3","Line 4"]with open(r'C:\path\to\output.txt', 'w', encoding='utf-8') as f:f.writelines([line + '\n' for line in lines])
Text Processing
Search and Replace
python
with open(r'C:\path\to\file.txt', 'r', encoding='utf-8') as f:content = f.read()# Simple replacenew_content = content.replace('old_text', 'new_text')# Using regular expressionsimport renew_content = re.sub(r'pattern', 'replacement', content)with open(r'C:\path\to\output.txt', 'w', encoding='utf-8') as f:f.write(new_content)
Extract Specific Lines
python
with open(r'C:\path\to\file.txt', 'r', encoding='utf-8') as f:lines = f.readlines()# Get lines 5-10selected_lines = lines[4:10] # Zero-indexed# Get lines matching patternimport repattern = re.compile(r'keyword')matching_lines = [line for line in lines if pattern.search(line)]with open(r'C:\path\to\output.txt', 'w', encoding='utf-8') as f:f.writelines(matching_lines)
Count Words, Lines, Characters
python
with open(r'C:\path\to\file.txt', 'r', encoding='utf-8') as f:content = f.read()lines = content.splitlines()words = content.split()chars = len(content)print(f"Lines: {len(lines)}")print(f"Words: {len(words)}")print(f"Characters: {chars}")
Data Extraction
Extract Structured Data
python
import rewith open(r'C:\path\to\file.txt', 'r', encoding='utf-8') as f:content = f.read()# Extract emailsemails = re.findall(r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b', content)# Extract URLsurls = re.findall(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', content)# Extract numbersnumbers = re.findall(r'\d+', content)print(f"Emails found: {emails}")print(f"URLs found: {urls}")print(f"Numbers found: {numbers}")
Parse Delimited Data
python
with open(r'C:\path\to\file.txt', 'r', encoding='utf-8') as f:lines = f.readlines()# Parse pipe-delimited datadata = []for line in lines:fields = [field.strip() for field in line.split('|')]data.append(fields)print(data)
File Merging and Splitting
Merge Multiple Text Files
python
import osfiles = [r'C:\path\to\file1.txt',r'C:\path\to\file2.txt',r'C:\path\to\file3.txt']with open(r'C:\path\to\merged.txt', 'w', encoding='utf-8') as outfile:for file in files:with open(file, 'r', encoding='utf-8') as infile:outfile.write(infile.read())outfile.write('\n') # Add separator
Split File by Size
python
def split_file(file_path, lines_per_file=1000):with open(file_path, 'r', encoding='utf-8') as f:lines = f.readlines()for i in range(0, len(lines), lines_per_file):chunk = lines[i:i + lines_per_file]output_file = f'part_{i//lines_per_file}.txt'with open(output_file, 'w', encoding='utf-8') as f:f.writelines(chunk)split_file(r'C:\path\to\large_file.txt')
Text Analysis
Word Frequency
python
from collections import Counterwith open(r'C:\path\to\file.txt', 'r', encoding='utf-8') as f:content = f.read().lower()words = content.split()filtered_words = [w for w in words if len(w) > 3] # Skip short wordsword_counts = Counter(filtered_words)print(word_counts.most_common(20)) # Top 20 words
Unique Lines
python
with open(r'C:\path\to\file.txt', 'r', encoding='utf-8') as f:lines = f.readlines()unique_lines = list(set(lines))with open(r'C:\path\to\output.txt', 'w', encoding='utf-8') as f:f.writelines(unique_lines)
Tips and Best Practices
- Always specify encoding: Use
encoding='utf-8'for Windows compatibility - Use context managers: Always use
withstatements for proper file closure - Handle errors: Wrap file operations in try/except blocks
- Large files: For very large files, read line-by-line instead of loading all at once
- Path handling: Use raw strings (
r'...') for Windows paths to avoid escape issues - Line endings: Be aware of different line endings (LF vs CRLF on Windows)
- Permissions: Ensure write permissions before trying to create/modify files