我有一个目录(机密),其中包含一堆文本文件。
机密的
:- Secret-file1.txt
:- Secret-file2.txt
:- Secret-file3.txt
我想生成另一个文本文件(Summary.txt),文本宽度为 80,格式如下
Secret-file1 - This file describes various secret activities of
organization Secret-Organization-1
Secret-file2 - This file describes various secret activities of
organization Secret-Organization-2. This summarizes
their activities from year 2001.
Secret-file3 - This file describes various secret activities of
organization Secret-Organization-3. This summarizes
their activities from year 2024.
其中第二列右对齐并从相应文本文件的第一行复制。例如,“Secret-file1.txt”看起来像这样
This file describes various secret activities of organization Secret-Organization-1.
XXXXXXXXXXXXXXXXX BUNCH of TEXT TILL EOF XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
我怎样才能做到这一点?我正在查看 bash 的各种选项(例如,sed、awk、grep、your-prefered-bash-built-in)。
谢谢
一个