当前位置:首页>Linux>Linux AWK 高级用法深度解析

Linux AWK 高级用法深度解析

  • 2026-01-20 18:36:58
Linux AWK 高级用法深度解析
一、AWK 高级特性概述
AWK 不仅仅是一个文本处理工具,它是一门完整的编程语言。以下是 AWK 的高级特性分类:
特性类别
主要功能
应用场景
数组处理
关联数组、多维数组
数据统计、分组汇总
函数编程
内置函数、自定义函数
复杂计算、字符串处理
模式匹配
正则表达式、范围模式
日志分析、数据提取
系统交互
执行系统命令、文件操作
系统管理、自动化脚本
高级I/O
多文件处理、管道
大数据处理、报表生成
二、高级数组处理
2.1 关联数组深度应用
#!/bin/bash
# awk-advanced-arrays.sh

echo"=== AWK 高级数组处理 ==="

# 创建复杂的测试数据
cat > sales_data.txt << 'EOF'
2024-01-15,John,Electronics,1200.50,New York
2024-01-15,Jane,Clothing,850.75,Los Angeles
2024-01-15,Bob,Electronics,2100.00,New York
2024-01-16,John,Clothing,450.25,New York
2024-01-16,Jane,Electronics,1800.00,Los Angeles
2024-01-16,Alice,Books,320.50,Chicago
2024-01-17,Bob,Books,280.75,New York
2024-01-17,John,Electronics,950.00,New York
2024-01-17,Jane,Clothing,675.50,Los Angeles
EOF

echo"📊 销售数据:"
column -t -s',' sales_data.txt
echo"========================================"

# 1. 多维统计
echo"1. 📈 多维数据统计 (城市×品类):"
awk -F ',''
{
    date = $1
    salesperson = $2
    category = $3
    amount = $4
    city = $5

    # 多维统计
    sales_by_city_category[city][category] += amount
    sales_by_date_city[date][city] += amount
    salesperson_total[salesperson] += amount
    daily_total[date] += amount

    # 计数
    transaction_count[city][category]++
}
END {
    print "=== 城市×品类销售统计 ==="
    for (city in sales_by_city_category) {
        for (category in sales_by_city_category[city]) {
            printf "%-12s %-12s $%8.2f (%d笔)\n", 
                   city, category, 
                   sales_by_city_category[city][category],
                   transaction_count[city][category]
        }
    }

    print "\n=== 销售员业绩排名 ==="
    # 使用asorti对关联数组的索引进行排序
    n = asorti(salesperson_total, sorted_salespersons)
    for (i = n; i >= 1; i--) {
        person = sorted_salespersons[i]
        printf "%-8s: $%8.2f\n", person, salesperson_total[person]
    }
}'
 sales_data.txt

# 2. 数组的数组
echo -e "\n2. 🎯 复杂数据结构:"
awk -F ',''
{
    city = $5
    category = $3
    amount = $4

    # 创建城市→品类→金额的嵌套结构
    if (!(city in city_data)) {
        city_data[city]["total"] = 0
        city_data[city]["count"] = 0
        city_data[city]["categories"] = 0
    }

    city_data[city]["total"] += amount
    city_data[city]["count"]++

    if (!(category in city_data[city])) {
        city_data[city][category] = 0
        city_data[city]["categories"]++
    }
    city_data[city][category] += amount
}
END {
    print "=== 城市详细统计 ==="
    for (city in city_data) {
        printf "\n🏙️  城市: %s\n", city
        printf "   总销售额: $%.2f\n", city_data[city]["total"]
        printf "   交易笔数: %d\n", city_data[city]["count"]
        printf "   品类数量: %d\n", city_data[city]["categories"]

        # 输出每个品类的销售
        for (key in city_data[city]) {
            if (key != "total" && key != "count" && key != "categories") {
                printf "   %-12s: $%8.2f\n", key, city_data[city][key]
            }
        }
    }
}'
 sales_data.txt

# 清理
rm sales_data.txt
2.2 数组函数和操作
#!/bin/bash
# awk-array-functions.sh

echo"=== AWK 数组函数高级应用 ==="

# 创建测试数据
cat > student_scores.txt << 'EOF'
Alice:Math:95:Physics:88:Chemistry:92
Bob:Math:78:Physics:85:Chemistry:90
Carol:Math:92:Physics:96:Chemistry:94
David:Math:85:Physics:82:Chemistry:88
Eve:Math:91:Physics:89:Chemistry:93
EOF

echo"📊 学生成绩数据:"
cat student_scores.txt
echo"========================================"

# 1. 数组长度和遍历
echo"1. 📏 数组操作函数:"
awk -F ':''
{
    student = $1
    # 动态创建科目→成绩的映射
    for (i = 2; i <= NF; i += 2) {
        subject = $i
        score = $(i+1)
        scores[student][subject] = score
        subjects[subject]++  # 记录所有科目
    }
}
END {
    print "=== 学生成绩统计 ==="

    # 获取学生数量
    student_count = length(scores)
    printf "学生数量: %d\n", student_count

    # 获取科目数量
    subject_count = length(subjects)
    printf "科目数量: %d\n", subject_count

    # 遍历所有学生
    print "\n📋 学生列表:"
    for (student in scores) {
        printf "%-8s", student
    }
    print ""

    # 遍历所有科目并计算平均分
    print "\n📊 科目平均分:"
    for (subject in subjects) {
        total = 0
        count = 0
        for (student in scores) {
            if (subject in scores[student]) {
                total += scores[student][subject]
                count++
            }
        }
        avg = total / count
        printf "%-10s: %.1f\n", subject, avg
    }

    # 删除数组元素示例
    print "\n🗑️  删除Bob的数据后:"
    delete scores["Bob"]
    for (student in scores) {
        printf "%-8s", student
    }
    print ""
}'
 student_scores.txt

# 2. 数组复制和比较
echo -e "\n2. 🔄 数组的复制和比较:"
awk '
BEGIN {
    # 创建源数组
    source["Math"] = 90
    source["Physics"] = 85
    source["Chemistry"] = 92

    print "源数组:"
    for (key in source) {
        printf "  %s: %d\n", key, source[key]
    }

    # 数组复制(手动)
    print "\n复制数组:"
    for (key in source) {
        copy[key] = source[key]
        printf "  %s: %d\n", key, copy[key]
    }

    # 检查数组是否相等
    is_equal = 1
    for (key in source) {
        if (!(key in copy) || source[key] != copy[key]) {
            is_equal = 0
            break
        }
    }
    if (length(source) != length(copy)) {
        is_equal = 0
    }

    print "\n数组相等:", is_equal ? "是" : "否"

    # 修改副本并再次比较
    copy["Math"] = 95
    is_equal_after = 1
    for (key in source) {
        if (!(key in copy) || source[key] != copy[key]) {
            is_equal_after = 0
            break
        }
    }
    print "修改后相等:", is_equal_after ? "是" : "否"
}'


# 清理
rm student_scores.txt
三、高级函数编程
3.1 自定义函数深度应用
#!/bin/bash
# awk-custom-functions.sh

echo"=== AWK 自定义函数高级应用 ==="

# 创建金融交易数据
cat > transactions.txt << 'EOF'
2024-01-15T10:30:25,INV-001,John Doe,1500.00,COMPLETED
2024-01-15T11:15:30,INV-002,Jane Smith,2750.50,COMPLETED
2024-01-15T12:45:15,INV-003,Bob Johnson,980.75,PENDING
2024-01-15T14:20:40,INV-004,Alice Brown,3200.25,COMPLETED
2024-01-15T15:55:10,INV-005,Charlie Wilson,450.00,FAILED
EOF

echo"💳 交易数据:"
cat transactions.txt
echo"========================================"

# 1. 自定义函数库
echo"1. 🛠️  自定义函数库实现:"
awk -F ',''
# 函数定义必须在BEGIN之前
function format_amount(amount) {
    if (amount >= 1000) {
        return sprintf("$%\'
d", amount)
    } else {
        return sprintf("
$%.2f", amount)
    }
}

function get_status_color(status) {
    switch (status) {
        case "
COMPLETED":
            return "
"
        case "
PENDING":
            return "
"
        case "
FAILED":
            return "
"
        default:
            return "
"
    }
}

function parse_timestamp(timestamp,    datetime, date, time) {
    split(timestamp, datetime, "
T")
    date = datetime[1]
    time = datetime[2]
    gsub(/-/, "
/", date)  # 转换日期格式
    return date "
" time
}

function calculate_tax(amount, rate) {
    return amount * rate
}

function generate_report_line(transaction,    fields) {
    split(transaction, fields, "
,")
    return sprintf("
%s %s %-12s %12s %s",
        get_status_color(fields[5]),
        parse_timestamp(fields[1]),
        fields[3],
        format_amount(fields[4]),
        fields[5])
}

# 主处理逻辑
{
    # 使用自定义函数处理数据
    formatted = generate_report_line($0)
    print formatted

    # 统计信息
    total_amount += $4
    status_count[$5]++
}
END {
    print "
\n=== 交易统计 ==="
    printf "
总交易金额: %s\n", format_amount(total_amount)
    printf "
平均交易额: %s\n", format_amount(total_amount / NR)

    print "
\n交易状态分布:"
    for (status in status_count) {
        printf "
%-10s: %d 笔\n", status, status_count[status]
    }

    # 计算税费示例
    tax_rate = 0.08
    tax_amount = calculate_tax(total_amount, tax_rate)
    printf "
\n税费估算 (%.1f%%): %s\n", tax_rate * 100, format_amount(tax_amount)
}' transactions.txt

# 2. 递归函数和数学计算
echo -e "
\n2. 🔢 高级数学函数:"
awk '
# 递归计算阶乘
function factorial(n) {
    if (n <= 1) return 1
    return n * factorial(n - 1)
}

# 计算组合数 C(n, k)
function combination(n, k) {
    if (k < 0 || k > n) return 0
    return factorial(n) / (factorial(k) * factorial(n - k))
}

# 计算排列数 P(n, k)
function permutation(n, k) {
    if (k < 0 || k > n) return 0
    return factorial(n) / factorial(n - k)
}

# 主程序
BEGIN {
    print "
=== 高级数学计算 ==="

    # 测试阶乘
    print "
阶乘计算:"
    for (i = 1; i <= 10; i++) {
        printf "
%-2d! = %d\n", i, factorial(i)
    }

    # 测试组合数
    print "
\n组合数计算 C(5, k):"
    for (k = 0; k <= 5; k++) {
        printf "
C(5, %d) = %d\n", k, combination(5, k)
    }

    # 测试排列数
    print "
\n排列数计算 P(5, k):"
    for (k = 0; k <= 5; k++) {
        printf "
P(5, %d) = %d\n", k, permutation(5, k)
    }
}'

# 清理
rm transactions.txt
3.2 函数式编程特性
#!/bin/bash
# awk-functional-programming.sh

echo"=== AWK 函数式编程特性 ==="

# 创建数据处理示例
cat > numbers.txt << 'EOF'
10 25 38 42 15 67 89 53 21 74
35 18 92 57 63 29 81 46 12 95
EOF

echo"🔢 数字数据:"
cat numbers.txt
echo"========================================"

# 1. 高阶函数应用
echo"1. 🎯 高阶函数模式:"
awk '
# 映射函数 (map)
function map(array, func,    i, result) {
    for (i in array) {
        result[i] = func(array[i])
    }
    return result
}

# 过滤函数 (filter)
function filter(array, func,    i, result, count) {
    count = 0
    for (i in array) {
        if (func(array[i])) {
            result[++count] = array[i]
        }
    }
    return result
}

# 归约函数 (reduce)
function reduce(array, func, initial,    i, result) {
    result = initial
    for (i in array) {
        result = func(result, array[i])
    }
    return result
}

# 实用函数
function square(x) { return x * x }
function is_even(x) { return x % 2 == 0 }
function sum(a, b) { return a + b }
function max(a, b) { return a > b ? a : b }

BEGIN {
    # 创建测试数组
    numbers[1] = 10; numbers[2] = 25; numbers[3] = 38; numbers[4] = 42
    numbers[5] = 15; numbers[6] = 67; numbers[7] = 89; numbers[8] = 53
    numbers[9] = 21; numbers[10] = 74

    print "原始数组:", array_to_string(numbers)

    # 使用map
    squared = map(numbers, square)
    print "平方映射:", array_to_string(squared)

    # 使用filter
    evens = filter(numbers, is_even)
    print "偶数过滤:", array_to_string(evens)

    # 使用reduce
    total = reduce(numbers, sum, 0)
    maximum = reduce(numbers, max, numbers[1])

    print "总和归约:", total
    print "最大值归约:", maximum

    # 函数组合: 先过滤偶数,再求平方,最后求和
    result = reduce(map(filter(numbers, is_even), square), sum, 0)
    print "组合操作结果:", result
}

function array_to_string(arr,    i, str) {
    str = ""
    for (i = 1; i <= length(arr); i++) {
        str = str (str ? ", " : "") arr[i]
    }
    return "[" str "]"
}'


# 2. 闭包和柯里化
echo -e "\n2. 🔗 闭包和柯里化模式:"
awk '
# 柯里化函数:创建特定乘数的函数
function multiplier(factor) {
    return function(x) { return x * factor }
}

# 闭包示例:计数器工厂
function counter(initial) {
    var count = initial
    return function() { return ++count }
}

# 记忆化函数
function memoize(func,    cache) {
    return function(arg) {
        if (!(arg in cache)) {
            cache[arg] = func(arg)
        }
        return cache[arg]
    }
}

BEGIN {
    print "=== 函数式编程模式 ==="

    # 柯里化应用
    double = multiplier(2)
    triple = multiplier(3)

    print "柯里化测试:"
    printf "double(5) = %d\n", double(5)
    printf "triple(5) = %d\n", triple(5)

    # 闭包应用
    count1 = counter(0)
    count2 = counter(100)

    print "\n闭包计数器:"
    print "计数器1:", count1(), count1(), count1()
    print "计数器2:", count2(), count2(), count2()

    # 记忆化应用
    memoized_factorial = memoize(function(n) {
        if (n <= 1) return 1
        return n * memoized_factorial(n - 1)
    })

    print "\n记忆化阶乘:"
    print "10! =", memoized_factorial
四、AWK 复杂字符串处理深度指南
1.AWK 字符串处理核心功能
AWK 提供了强大的字符串处理能力,以下是主要功能分类:
功能类别
主要函数
应用场景
基础操作
length, substr, index
字符串长度、子串提取、位置查找
模式匹配
match, gensub, gsub
正则匹配、全局替换
分割合并
split, sprintf
字符串分割、格式化输出
转换处理
toupper, tolower, strtonum
大小写转换、字符串转数字
编码处理
ENVIRON, system
环境变量、系统调用
2.基础字符串操作
2.1 常用字符串函数
#!/bin/bash
# awk-string-basics.sh

echo"=== AWK 基础字符串操作 ==="

# 创建测试数据
cat > string_data.txt << 'EOF'
Hello World
AWK Programming
Linux System Administration
test@example.com
+1-555-0123
2024-01-15T14:30:00
EOF

echo"📝 测试字符串数据:"
cat string_data.txt
echo"========================================"

# 1. 基础字符串函数
echo"1. 🔧 基础字符串函数演示:"
awk '
{
    print "原始字符串:", $0
    print "字符串长度:", length($0)

    # substr 提取子串
    if (length($0) >= 5) {
        print "前5个字符:", substr($0, 1, 5)
        print "后5个字符:", substr($0, length($0)-4, 5)
    }

    # index 查找位置
    pos = index($0, " ")
    if (pos > 0) {
        print "第一个空格位置:", pos
    }

    print "---"
}'
 string_data.txt

# 2. 大小写转换和字符操作
echo -e "\n2. 🔄 大小写和字符处理:"
awk '
{
    print "原始:", $0
    print "大写:", toupper($0)
    print "小写:", tolower($0)

    # 首字母大写
    if ($0 != "") {
        first_char = substr($0, 1, 1)
        rest_chars = substr($0, 2)
        print "首字母大写:", toupper(first_char) tolower(rest_chars)
    }
    print "---"
}'
 string_data.txt
3.高级模式匹配
3.1 正则表达式深度应用
#!/bin/bash
# awk-regex-advanced.sh

echo"=== AWK 高级正则表达式处理 ==="

# 创建复杂文本数据
cat > complex_text.txt << 'EOF'
Contact: john.doe@example.com, phone: +1-555-0123
Meeting: 2024-01-15T14:30:00 at Office-123
Price: $1,299.99, Discount: 15%
IP: 192.168.1.1, Mask: 255.255.255.0
JSON: {"name""John""age": 30, "active"true}
EOF

echo"📄 复杂文本数据:"
cat complex_text.txt
echo"========================================"

# 1. match 函数的高级用法
echo"1. 🎯 match 函数捕获组:"
awk '
{
    # 匹配邮箱并提取用户名和域名
    if (match($0, /([a-zA-Z0-9._%+-]+)@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/, arr)) {
        print "📧 邮箱匹配:"
        print "  完整邮箱:", arr[0]
        print "  用户名:", arr[1]
        print "  域名:", arr[2]
    }

    # 匹配价格格式
    if (match($0, /\$[0-9,]+(\.[0-9]{2})?/, arr)) {
        print "💰 价格匹配:", arr[0]
    }

    # 匹配日期时间
    if (match($0, /[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}/, arr)) {
        print "📅 时间匹配:", arr[0]
    }

    print "---"
}'
 complex_text.txt

# 2. gensub 高级替换
echo -e "\n2. 🔄 gensub 高级替换模式:"
awk '
{
    original = $0

    # 使用gensub进行复杂替换
    # 替换邮箱域名
    email_replaced = gensub(/([a-zA-Z0-9._%+-]+)@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/, 
                           "\\1@company.com", "g", $0)

    # 隐藏电话号码
    phone_replaced = gensub(/\+?[0-9-]{10,}/, 
                           "***-***-****", "g", email_replaced)

    # 格式化价格
    formatted = gensub(/\$([0-9,]+(\.[0-9]{2})?)/, 
                      "💰 \\1", "g", phone_replaced)

    print "原始:", original
    print "处理后:", formatted
    print "---"
}'
 complex_text.txt
3.2 多模式匹配和处理
#!/bin/bash
# awk-multi-pattern.sh

echo"=== AWK 多模式匹配处理 ==="

# 创建多模式测试数据
cat > multi_pattern.txt << 'EOF'
ERROR: Database connection failed at 2024-01-15 14:30
WARNING: High memory usage: 85% 
INFO: User login: john@example.com
DEBUG: Query executed in 150ms
ERROR: File not found: /path/to/file.txt
INFO: Backup completed successfully
EOF

echo"📋 日志模式数据:"
cat multi_pattern.txt
echo"========================================"

# 复杂多模式匹配和提取
awk '
{
    # 定义匹配模式数组
    patterns["ERROR"] = "❌"
    patterns["WARNING"] = "⚠️ "
    patterns["INFO"] = "ℹ️ "
    patterns["DEBUG"] = "🐛"

    # 检查每种模式
    for (pattern in patterns) {
        if (match($0, pattern ": ([^:]+):? (.+)", arr)) {
            print patterns[pattern] " " pattern ":"
            print "   消息:", arr[2]

            # 提取额外信息
            if (pattern == "ERROR" && match($0, /at ([0-9:-]+)/, time_arr)) {
                print "   时间:", time_arr[1]
            }
            if (match($0, /([0-9]+)%/, percent_arr)) {
                print "   百分比:", percent_arr[1] "%"
            }
            if (match($0, /in ([0-9]+ms)/, time_arr)) {
                print "   耗时:", time_arr[1]
            }
            break
        }
    }
}'
 multi_pattern.txt
4.字符串分割和重组
4.1 高级 split 函数应用
#!/bin/bash
# awk-split-advanced.sh

echo"=== AWK 高级字符串分割 ==="

# 创建需要分割的数据
cat > split_data.txt << 'EOF'
name=John Doe;age=30;city=New York;email=john@example.com
name=Jane Smith;age=25;city=Los Angeles;phone=555-0123
name=Bob Wilson;age=35;department=Engineering;salary=75000
EOF

echo"🔗 键值对数据:"
cat split_data.txt
echo"========================================"

# 1. 复杂分割和数据结构构建
echo"1. 🧩 多级分割和数据结构:"
awk -F ';''
{
    print "处理记录:", NR

    # 第一级分割:分号分隔
    for (i = 1; i <= NF; i++) {
        # 第二级分割:等号分隔
        split($i, keyvalue, "=")
        if (length(keyvalue) >= 2) {
            key = keyvalue[1]
            value = keyvalue[2]

            # 存储到多维数组
            data[NR][key] = value
            all_keys[key]++  # 记录所有出现的key
        }
    }
}
END {
    print "\n📊 数据统计:"

    # 输出表格格式
    printf "%-6s", "Record"
    for (key in all_keys) {
        printf "%-15s", key
    }
    print ""

    # 输出分隔线
    printf "%-6s", "------"
    for (key in all_keys) {
        printf "%-15s", "---------------"
    }
    print ""

    # 输出数据
    for (record in data) {
        printf "%-6d", record
        for (key in all_keys) {
            value = (key in data[record]) ? data[record][key] : "N/A"
            printf "%-15s", value
        }
        print ""
    }
}'
 split_data.txt

# 2. CSV 和复杂分隔符处理
echo -e "\n2. 📋 CSV 和复杂格式处理:"
cat > complex_csv.txt << 'EOF'
"John Doe",30,"New York, NY","john@example.com"
"Jane Smith",25,"Los Angeles, CA","jane.smith@company.com"
"Bob ""The Boss"" Johnson",35,"Chicago, IL","bob@test.org"
EOF

awk '
BEGIN {
    FPAT = "([^,]*)|(\"[^\"]+\")"  # 处理带引号的字段
}
{
    print "记录", NR ":"
    for (i = 1; i <= NF; i++) {
        # 移除引号
        gsub(/^\"|\"$/, "", $i)
        gsub(/\"\"/, "\"", $i)  # 处理转义引号
        printf "  字段%d: %s\n", i, $i
    }
    print "---"
}'
 complex_csv.txt
5.实战应用案例
5.1 日志文件分析
#!/bin/bash
# awk-log-analysis.sh

echo "=== AWK 日志文件分析实战 ==="

# 创建模拟的Web服务器日志
cat > web_server.log << 'EOF'
192.168.1.1 - - [15/Jan/2024:10:30:25 +0800] "GET /index.html HTTP/1.1" 200 1524 "http://example.com" "Mozilla/5.0"
192.168.1.2 - - [15/Jan/2024:10:30:26 +0800] "
GET /about.html HTTP/1.1" 200 2345 "http://example.com" "Mozilla/5.0"
192.168.1.3 - - [15/Jan/2024:10:30:27 +0800] "
POST /login HTTP/1.1" 302 0 "http://example.com" "Chrome/91.0"
192.168.1.1 - - [15/Jan/2024:10:30:28 +0800] "
GET /products HTTP/1.1" 200 5678 "http://example.com" "Firefox/89.0"
192.168.1.4 - - [15/Jan/2024:10:30:29 +0800] "
GET /nonexistent HTTP/1.1" 404 123 "http://example.com" "Safari/14.0"
192.168.1.2 - - [15/Jan/2024:10:30:30 +0800] "
GET /api/data HTTP/1.1" 200 3456 "http://example.com" "Mozilla/5.0"
EOF

echo "
🌐 Web服务器日志:"
cat web_server.log
echo "
========================================"

# 高级日志分析
awk '
{
    # 使用match提取日志字段
    if (match($0, /^([0-9.]+) .* \[(.*)\] "
(.*)" ([0-9]+) ([0-9]+) "(.*)" "(.*)"/, arr)) {
        ip = arr[1]
        timestamp = arr[2]
        request = arr[3]
        status = arr[4]
        bytes = arr[5]
        referer = arr[6]
        user_agent = arr[7]

        # 进一步解析请求
        if (match(request, /^([A-Z]+) (.*) HTTP/, req_arr)) {
            method = req_arr[1]
            path = req_arr[2]

            # 统计信息
            ip_count[ip]++
            status_count[status]++
            method_count[method]++
            total_bytes += bytes

            # 路径分析
            if (match(path, "
^/[^/?]*", path_arr)) {
                endpoint = path_arr[0]
                endpoint_count[endpoint]++
                endpoint_bytes[endpoint] += bytes
            }
        }
    }
}
END {
    print "
📊 访问统计报告"
    print "
================"

    # IP统计
    print "
\n🌐 客户端IP统计:"
    for (ip in ip_count) {
        printf "
%-15s: %d次访问\n", ip, ip_count[ip]
    }

    # 状态码统计
    print "
\n📋 HTTP状态码分布:"
    for (status in status_count) {
        printf "
%-4s: %d次\n", status, status_count[status]
    }

    # 方法统计
    print "
\n🛠️  请求方法统计:"
    for (method in method_count) {
        printf "
%-6s: %d次\n", method, method_count[method]
    }

    # 端点统计
    print "
\n📍 热门端点:"
    for (endpoint in endpoint_count) {
        if (endpoint_count[endpoint] > 1) {
            avg_size = endpoint_bytes[endpoint] / endpoint_count[endpoint]
            printf "
%-12s: %d次访问, 平均%.0f字节\n", 
                   endpoint, endpoint_count[endpoint], avg_size
        }
    }

    # 总体统计
    print "
\n📈 总体统计:"
    printf "
总请求数: %d\n", NR
    printf "
总流量: %.1fKB\n", total_bytes / 1024
    printf "
平均请求大小: %.0f字节\n", total_bytes / NR
}' web_server.log

# 清理
rm web_server.log
5.2 配置文件处理
#!/bin/bash
# awk-config-processing.sh

echo"=== AWK 配置文件处理实战 ==="

# 创建复杂的配置文件
cat > app_config.conf << 'EOF'
# Database Configuration
db.host = mysql.example.com
db.port = 3306
db.name = myapp_db
db.user = admin
db.password = secret123

# Server Settings
server.host = 0.0.0.0
server.port = 8080
server.timeout = 30
server.ssl.enabled = true
server.ssl.cert = /path/to/cert.pem

# Logging
log.level = INFO
log.file = /var/log/app.log
log.max_size = 100MB

# Feature Flags
features.api.enabled = true
features.ui.enabled = false
features.debug.mode = false
EOF

echo"⚙️  配置文件内容:"
cat app_config.conf
echo"========================================"

# 高级配置文件处理
awk '
function parse_section(line,    parts) {
    if (match(line, /^# ([A-Za-z ]+)$/, arr)) {
        current_section = arr[1]
        sections[current_section] = ""
        return 1
    }
    return 0
}

function parse_setting(line,    key, value, parts) {
    if (match(line, /^([a-zA-Z0-9._]+) *= *(.*)$/, arr)) {
        key = arr[1]
        value = arr[2]

        # 移除行尾注释
        gsub(/#.*$/, "", value)
        gsub(/^ *| *$/, "", value)  # 去除首尾空格

        # 存储配置
        settings[key] = value
        setting_sections[key] = current_section

        # 按section分组
        section_settings[current_section][key] = value

        return 1
    }
    return 0
}

{
    # 跳过空行
    if ($0 ~ /^[[:space:]]*$/) next

    # 解析section
    if (!parse_section($0)) {
        # 解析配置项
        if (!parse_setting($0)) {
            print "无法解析行:", NR ": " $0 > "/dev/stderr"
        }
    }
}

END {
    print "📋 配置分析报告"
    print "================"

    # 按section输出配置
    print "\n📁 配置分组:"
    for (section in sections) {
        print "\n" section ":"
        print "---------"
        for (key in section_settings[section]) {
            value = section_settings[section][key]
            printf "%-20s = %s\n", key, value
        }
    }

    # 统计信息
    print "\n📊 配置统计:"
    printf "总配置项数: %d\n", length(settings)
    printf "配置段落数: %d\n", length(sections)

    # 敏感信息检查
    print "\n🔒 敏感信息检查:"
    sensitive_patterns["password"] = "密码"
    sensitive_patterns["secret"] = "密钥"
    sensitive_patterns["cert"] = "证书"

    for (key in settings) {
        for (pattern in sensitive_patterns) {
            if (index(tolower(key), pattern) > 0) {
                printf "

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-02-08 12:39:17 HTTP/2.0 GET : https://f.mffb.com.cn/a/464727.html
  2. 运行时间 : 0.084639s [ 吞吐率:11.81req/s ] 内存消耗:4,764.96kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=a06f1c739333a6a988f3ce8c9fd75a7a
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000589s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000792s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000283s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000284s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000474s ]
  6. SELECT * FROM `set` [ RunTime:0.000196s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000536s ]
  8. SELECT * FROM `article` WHERE `id` = 464727 LIMIT 1 [ RunTime:0.000533s ]
  9. UPDATE `article` SET `lasttime` = 1770525557 WHERE `id` = 464727 [ RunTime:0.005454s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 67 LIMIT 1 [ RunTime:0.000259s ]
  11. SELECT * FROM `article` WHERE `id` < 464727 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000861s ]
  12. SELECT * FROM `article` WHERE `id` > 464727 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000432s ]
  13. SELECT * FROM `article` WHERE `id` < 464727 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.000768s ]
  14. SELECT * FROM `article` WHERE `id` < 464727 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.001584s ]
  15. SELECT * FROM `article` WHERE `id` < 464727 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.007051s ]
0.086273s