#!/bin/bash
# 读取文件到数组(如果文件不大)
mapfile -t cust_ids < CUSTOMER_ORDER_ID.txt
mapfile -t phones < phone.txt
mapfile -t workflow_ids < WORKFLOW_TASK_ID.txt
mapfile -t dates < date.txt # 如果有日期文件
# 按行号遍历
for i in "${!phones[@]}"; do #读取每行文本索引数组
cust_id="${cust_ids[$i]}" #读取索引对应的文本数据
phone="${phones[$i]}"
workflow_id="${workflow_ids[$i]}"
date="${dates[$i]:-202508}" # 如果没有日期文件,使用默认值202508
# 清理数据(去除回车和首尾空格)
cust_id=$(echo "$cust_id" | tr -d '\r' | xargs)
phone=$(echo "$phone" | tr -d '\r' | xargs)
workflow_id=$(echo "$workflow_id" | tr -d '\r' | xargs)
date=$(echo "$date" | tr -d '\r' | xargs)
echo "$phone"
done