---
name: php186-skill-9702
description: "将 JSON、CSV、XML 和日志解析为结构化输出。适用于格式转换、结构验证、字段提取、嵌套数据分析。"
---

# Parser

## parser

 

Parse and extract data from various file formats.

 

## Commands

 

### ` json `

 

Parse JSON files (uses jq if available, else built-in)

 

```
scripts/script.sh json
```

 

### ` csv `

 

Parse CSV files, optionally extract a column by name or number

 

```
scripts/script.sh csv
```

 

### ` xml `

 

Parse XML files with optional XPath (requires python3)

 

```
scripts/script.sh xml
```

 

### ` yaml `

 

Parse YAML files with optional key path (requires python3)

 

```
scripts/script.sh yaml
```

 

### ` lines `

 

Filter lines by pattern (grep-like, with context)

 

```
scripts/script.sh lines
```

 

### ` split `

 

Split file content by delimiter

 

```
scripts/script.sh split
```

 

### ` extract `

 

Extract text matching a regex pattern

 

```
scripts/script.sh extract
```

 

### ` stats `

 

Show file statistics (lines, words, chars, encoding)

 

```
scripts/script.sh stats
```

 

## Requirements

 

- python3
- jq (optional)

 

*Powered by BytesAgain | bytesagain.com | hello@bytesagain.com*

 

## Data Storage

 

Parse results can be cached in ` ~/.local/share/parser/ `.
