SED remove everything before string

12,516

it is easy:

awk '/Summary of client activity for the last 24 hours/{p=1}p' file

Or sed:

sed -n '/Summary of client activity for the last 24 hours/,$p' file

Test with your email example with awk (sed cmd above has same output):

kent$  cat f
...(Personal Part of the Email)...
...
The following clients have no associated schedule
NodeDomainContact
-KABA-FILESYSTEM-
-USTICA-FILESYSTEM-

Summary of client activity for the last 24 hours
DomainNodenamePlatformTypeActivityData amountElapse timeAffectedFailedMedia     wait
-FILESYSTEM-ABSYNTHE-Linux x86-64-XFS-
BACKUP-
337.5 MB-
00:00-
60-
0-
0
...

kent$  awk '/Summary of client activity for the last 24 hours/{p=1}p' f
Summary of client activity for the last 24 hours
DomainNodenamePlatformTypeActivityData amountElapse timeAffectedFailedMedia     wait
-FILESYSTEM-ABSYNTHE-Linux x86-64-XFS-
BACKUP-
337.5 MB-
00:00-
60-
0-
0
..
Share:
12,516
Damon
Author by

Damon

Just started programming and not that experienced

Updated on June 04, 2022

Comments

  • Damon
    Damon almost 2 years

    I have a plain Mail and i need to remove everything before Summary of client activity for the last 24 hours i thought it would work best with sed.

    I searched the internet but there it's just with a delimiter or something similar.

    You have any ideas?

    Part of the Mail:

    ...(Personal Part of the Email)...
    ...
    The following clients have no associated schedule
    NodeDomainContact
    -KABA-FILESYSTEM-
    -USTICA-FILESYSTEM-
    
    Summary of client activity for the last 24 hours
    DomainNodenamePlatformTypeActivityData amountElapse timeAffectedFailedMedia     wait
    -FILESYSTEM-ABSYNTHE-Linux x86-64-XFS-
    BACKUP-
    337.5 MB-
    00:00-
    60-
    0-
    0
    ...
    

    Desired Output:

    Summary of client activity for the last 24 hours
    DomainNodenamePlatformTypeActivityData amountElapse timeAffectedFailedMedia     wait
    -FILESYSTEM-ABSYNTHE-Linux x86-64-XFS-
    BACKUP-
    337.5 MB-
    00:00-
    60-
    0-
    0
    ...
    
  • Kent
    Kent over 7 years
    @Damon interesting, I tested here again with the sed, it works.. :-( sed (GNU sed) 4.2.2
  • Damon
    Damon over 7 years
    4.2.1, maybe did something wrong on my side but it works, that's what matters