Issue
I have this input file with list of player names.
Cristiano Ronaldo
Anthony Martial
Jadon Sancho
Marcus Rashford
Bruno Fernandes
Fred
Scott McTominay
Donny Van De Beek
# Start U23 Team
Alvaro Fernandez
Zidane Iqbal
Facundo Pellistri
Hannibal Mejbri
Charlie Savage
# End U23 Team
Harry Maguire
Lisandro Martinez
Alex Telles
I want to exclude line starting with Start U23 Team
and end with End U23 Team
, so the end result will be:
Cristiano Ronaldo
Anthony Martial
Jadon Sancho
Marcus Rashford
Bruno Fernandes
Fred
Scott McTominay
Donny Van De Beek
Harry Maguire
Lisandro Martinez
Alex Telles
I can print the U23 Player with this command awk "/# End U23 Team/{f=0} f; /# Start U23 Team/{f=1}" file
, but how to do vice versa ?
Solution
Use the d
command in sed
to exclude lines.
sed '/# Start U23 Team/,/# End U23 Team/d' file
Answered By - Barmar Answer Checked By - Timothy Miller (WPSolving Admin)