いくつかのファイルのリストと他の詳細を含む複数の出力を提供するコマンドがあります。このコマンドまたはスクリプトの出力例は次のとおりです。
HOST NAME: ABC.us.XYZ.com
DESCRIBING VIEW: ...
TRANS_STATE: OPEN
ALL AFFECTED FILES:
1. abc/xyz/components/xyzCore/people/core/protectedModel/src/oracle/apps/xyz/people/core/protectedModel/entity/EmailAddressEOImpl.java [MERGE TO BRANCH -> st_abc_pt-v2mib/st_abc_pt-v2mibxyzgold/st_abc_pt-v2mibxyzgray/st_abc_pt-v2mibxyzbrown ]
2. abc/xyz/components/xyzCore/people/core/protectedModel/src/oracle/apps/xyz/people/core/protectedModel/entity/NationalIdentifierEOImpl.java [MERGE TO BRANCH -> st_abc_pt-v2mib/st_abc_pt-v2mibxyzgold/st_abc_pt-v2mibxyzgray/st_abc_pt-v2mibxyzbrown ]
3. abc/xyz/components/xyzCore/people/core/protectedModel/src/oracle/apps/xyz/people/core/protectedModel/entity/PhoneEOImpl.java [MERGE TO BRANCH -> st_abc_pt-v2mib/st_abc_pt-v2mibxyzgold/st_abc_pt-v2mibxyzgray/st_abc_pt-v2mibxyzbrown ]
4. abc/xyz/components/xyzCoreSetup/.adf/META-INF/connections.xml
5. abc/xyz/components/xyzCoreSetup/absenceManagement/absences/ui/xyzAbsMgmtAbsencesUi.jpr
CHECKEDOUT RESERVED:
1. abc/xyz/components/xyzCoreSetup/.adf/META-INF/connections.xml [edward_view2_brown]
2. abc/xyz/components/xyzCoreSetup/absenceManagement/absences/ui/xyzAbsMgmtAbsencesUi.jpr [edward_view2_brown]
3. abc/xyz/components/xyzCoreSetup/absenceManagement/accruals/ui/xyzAbsMgmtAccrualsUi.jpr [edward_view2_brown]
4. abc/xyz/components/xyzCoreSetup/absenceManagement/calendarEvents/ui/xyzAbsMgmtCalendarEventsUi.jpr [edward_view2_brown]
5. abc/xyz/components/xyzCoreSetup/absenceManagement/workSchedules/ui/xyzAbsMgmtWorkSchedsUi.jpr [edward_view2_brown]
BACKEND BRANCHED ELEMENTS:
================================================================================
abc/xyz/components/xyzCore/people/core/protectedModel/src/oracle/apps/xyz/people/core/protectedModel/entity/EmailAddressEOImpl.java@@/main/st_abc_pt-v2mib/st_abc_pt-v2mibxyzgold/st_abc_pt-v2mibxyzgray/st_abc_pt-v2mibxyzbrown/edward_tras1/1
abc/xyz/components/xyzCore/people/core/protectedModel/src/oracle/apps/xyz/people/core/protectedModel/entity/NationalIdentifierEOImpl.java@@/main/st_abc_pt-v2mib/st_abc_pt-v2mibxyzgold/st_abc_pt-v2mibxyzgray/st_abc_pt-v2mibxyzbrown/edward_tras1/1
================================================================================
以下に示すような出力が必要です。可能であれば、ファイルに書き込んだり、番号付けを削除したりすると便利です。
1. abc/xyz/components/xyzCore/people/core/protectedModel/src/oracle/apps/xyz/people/core/protectedModel/entity/EmailAddressEOImpl.java [MERGE TO BRANCH -> st_abc_pt-v2mib/st_abc_pt-v2mibxyzgold/st_abc_pt-v2mibxyzgray/st_abc_pt-v2mibxyzbrown ]
2. abc/xyz/components/xyzCore/people/core/protectedModel/src/oracle/apps/xyz/people/core/protectedModel/entity/NationalIdentifierEOImpl.java [MERGE TO BRANCH -> st_abc_pt-v2mib/st_abc_pt-v2mibxyzgold/st_abc_pt-v2mibxyzgray/st_abc_pt-v2mibxyzbrown ]
3. abc/xyz/components/xyzCore/people/core/protectedModel/src/oracle/apps/xyz/people/core/protectedModel/entity/PhoneEOImpl.java [MERGE TO BRANCH -> st_abc_pt-v2mib/st_abc_pt-v2mibxyzgold/st_abc_pt-v2mibxyzgray/st_abc_pt-v2mibxyzbrown ]
4. abc/xyz/components/xyzCoreSetup/.adf/META-INF/connections.xml
5. abc/xyz/components/xyzCoreSetup/absenceManagement/absences/ui/xyzAbsMgmtAbsencesUi.jpr
1. abc/xyz/components/xyzCoreSetup/.adf/META-INF/connections.xml [edward_view2_brown]
2. abc/xyz/components/xyzCoreSetup/absenceManagement/absences/ui/xyzAbsMgmtAbsencesUi.jpr [edward_view2_brown]
3. abc/xyz/components/xyzCoreSetup/absenceManagement/accruals/ui/xyzAbsMgmtAccrualsUi.jpr [edward_view2_brown]
4. abc/xyz/components/xyzCoreSetup/absenceManagement/calendarEvents/ui/xyzAbsMgmtCalendarEventsUi.jpr [edward_view2_brown]
5. abc/xyz/components/xyzCoreSetup/absenceManagement/workSchedules/ui/xyzAbsMgmtWorkSchedsUi.jpr [edward_view2_brown]
abc/xyz/components/xyzCore/people/core/protectedModel/src/oracle/apps/xyz/people/core/protectedModel/entity/EmailAddressEOImpl.java@@/main/st_abc_pt-v2mib/st_abc_pt-v2mibxyzgold/st_abc_pt-v2mibxyzgray/st_abc_pt-v2mibxyzbrown/edward_tras1/1
abc/xyz/components/xyzCore/people/core/protectedModel/src/oracle/apps/xyz/people/core/protectedModel/entity/NationalIdentifierEOImpl.java@@/main/st_abc_pt-v2mib/st_abc_pt-v2mibxyzgold/st_abc_pt-v2mibxyzgray/st_abc_pt-v2mibxyzbrown/edward_tras1/1
答え1
あなたabc/xyz/
は
| grep -o 'abc/xyz/.*' > output
-o
一致する部分を印刷するだけです。.*
行のすべての文字>
出力をファイルに送信output
答え2
ファイルがどのディレクトリにあるかを事前に知ることができない場合は、他のアプローチを使用できます。つまり、明らかにファイル名ではなくすべてのエントリを削除することです。
sed '1,/FILES:$/d
/^$/d
/^===/d
/RESERVED:$/d
/ELEMENTS:/d
s/^ *[0-9]\+\. *//
s/ *\[.*//'