Use sed to delete remainder of line after pattern

Greetings, I need some assistance here as I cannot get a sed line to work properly for me. I have the following list:

Camp.S01E04.720p.HDTV.X264-DIMENSION
Royal.Pains.S05E07.720p.HDTV.x264-IMMERSE
Whose.Line.is.it.Anyway.US.S09E05.720p.HDTV.x264-BAJSKORV

What I would like to accomplish is to delete everything after "720p" per line. Can you please assist me? :slight_smile:

So I would be left with

Camp.S01E04.720p
Royal.Pains.S05E07.720p
Whose.Line.is.it.Anyway.US.S09E05.720p
sed 's#720p.*#720p#' file
1 Like

Thanks! That worked perfectly!

With awk

awk '{sub(/720p.+/,"720p")}1' file