txtlisted
Install: claude install-skill Everfern-AI/Everfern
# 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 content
with open(r'C:\path\to\file.txt', 'r', encoding='utf-8') as f:
content = f.read()
print(content)
# Read line by line
with open(r'C:\path\to\file.txt', 'r', encoding='utf-8') as f:
for line in f:
print(line.strip())
# Read into list
with 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 replace
new_content = content.replace('old_text', 'new_text')
# Using regular expressi