0

I have a command which gives output a large output with list of some files and other details. The sample output of that command or script is shown below.

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
================================================================================

I need an output which will be similar to the one shown below. Writing it to the file or removing the numbering will be even more helpful if possible.

  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
4

If you just want the lines with abc/xyz/, you can pipe from your command into

| grep -o 'abc/xyz/.*' > output
  • -o just print the matched part
  • .* any characters on the line
  • > send the output to the file output
|improve this answer|||||
  • How to I remove the part in square brackets? – Abhishek Kothari Jan 30 '17 at 13:23
  • @AbhishekKothari Assuming the part in square brackets is always at the end of the line, you can use grep -o 'abc/xyz[^\[]*' > output – Zanna Jan 30 '17 at 13:29
0

If you do not know which directory the files will be in beforehand, you can use the alternative approach of discarding everything that is clearly not a filename:

sed '1,/FILES:$/d
     /^$/d
     /^===/d
     /RESERVED:$/d
     /ELEMENTS:/d
     s/^ *[0-9]\+\. *//
     s/ *\[.*//'
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.