I would like to delete the lines between two patterns but keep the line from the second pattern. For example for the file using MATER / 4401001 302 and / as a pattern:
$# IDMAT MATYP RHO ISINT ISHG ISTRAT IFROZ MATER / 4401001 302 0 0 0 $# BLANK QVM IDMPD 0 $# TITLE NAME PLINK Material $# SLFACM FSNVL DELTNL STNOR STTAN IFLGC BLANK TLSTIF 0.1 0 $# I3DOF TOLCOR IDRUP 0 1. 0 $---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 $# IDMAT MATYP RHO ISINT ISHG ISTRAT IFROZ MATER / 4401005 103 2.753E-6 0 4 I would like to get:
$# IDMAT MATYP RHO ISINT ISHG ISTRAT IFROZ MATER / 4401005 103 2.753E-6 0 4 I tried to do it using the following piece of code:
awk 'BEGIN{p=1} /MATER \/ 4401001/ {p=0} /\// {p=1} p' llink1.inc > llink2.inc But it doesn't work on my CentOS - the both files llink1.inc and llink2.inc are identical.
Could you help. Thank you