在这里,我尝试将第一个和第二个 wt^ 及其对应的 s^ 打印到输出文件,剩余的 wt^ 和 p^ 应该打印到另一个输出文件。我怎样才能做到这一点?
输入文件将是这样的
wt^RHEL System Overview(contd..)
s^Supported architectures include:
s^32-bit x86 compatible systems
s^64-bit AMD64 (Opteron) and Intel EM64T systems
wt^RHEL System Overview(contd..)
s^Common deployments
s^High volume deployments include:
s^Corporate applications (CRM, ERP, etc.)
s^Databases
wt^RHEL System Overview(contd..)
s^Network infrastructure systems
s^Web serving
s^File/print serving
s^HPC compute systems
输出文件应该是这样的
输出1.txt:
wt^RHEL System Overview(contd..)
s^Supported architectures include:
s^32-bit x86 compatible systems
s^64-bit AMD64 (Opteron) and Intel EM64T systems
wt^RHEL System Overview(contd..)
s^Common deployments
s^High volume deployments include:
s^Corporate applications (CRM, ERP, etc.)
s^Databases
输出2.txt:
wt^RHEL System Overview(contd..)
s^Network infrastructure systems
s^Web serving
s^File/print serving
s^HPC compute systems
我努力了
count=$(cat $( ls unit-*-slides.txt | sort -n ) | grep -E "[ ]*(st\^|p\^)" >> output.txt)
但这是打印整个东西。