我有以下文件file1和file2(作为示例)
$cat file1.txt
SERVICE: 1
TASK: 1
RESULT: 1
ADDITIONAL: 1
SERVICE: 2
TASK: 2
RESULT: 2
ADDITIONAL: 2
SERVICE: 3
TASK: 3
RESULT: 3
ADDITIONAL: 3
Run Code Online (Sandbox Code Playgroud)
$cat file2.txt
SERVICE: 1
TASK: 1
RESULT: 1
ADDITIONAL: 1
SERVICE: 2
TASK: 2
RESULT: 2
ADDITIONAL: 2
SERVICE: 3
TASK: 3
RESULT: 3
ADDITIONAL: 3
Run Code Online (Sandbox Code Playgroud)
我需要以下输出:
文件的名称和每个块在SERVICE上循环:在下面的1行中用管道"|"分开
file1.txt | SERVICE: 1 | TASK: 1 | RESULT: 1 | ADDITIONAL: 1
file1.txt | SERVICE: 2 | TASK: 2 | RESULT: 2 | ADDITIONAL: …Run Code Online (Sandbox Code Playgroud)