Skip to main content
edited body
Source Link
FelixJN
  • 14.1k
  • 2
  • 36
  • 55

Maybe with awk and string functions:

awk 'BEGIN{FS="START|END"}
     /START.*END+END/ {gsub(/_this_/,"",$2)
     gsub(/modi/,"MODI",$2)
     gsub(/a/,"4",$2)
     gsub(/s/,"5",$2)
     print $1"START"$2"END"$3 ; next}
     1' infile

Maybe with awk and string functions:

awk 'BEGIN{FS="START|END"}
     /START.*END/ {gsub(/_this_/,"",$2)
     gsub(/modi/,"MODI",$2)
     gsub(/a/,"4",$2)
     gsub(/s/,"5",$2)
     print $1"START"$2"END"$3 ; next}
     1' infile

Maybe with awk and string functions:

awk 'BEGIN{FS="START|END"}
     /START.+END/ {gsub(/_this_/,"",$2)
     gsub(/modi/,"MODI",$2)
     gsub(/a/,"4",$2)
     gsub(/s/,"5",$2)
     print $1"START"$2"END"$3 ; next}
     1' infile
adapted for lines without START/END pair and check for occurence of both
Source Link
FelixJN
  • 14.1k
  • 2
  • 36
  • 55

Maybe with awk and string functions:

awk 'BEGIN{FS="START|END"}
     /START.*END/ {gsub(/_this_/,"",$2)
      gsub(/modi/,"MODI",$2)
      gsub(/a/,"4",$2)
      gsub(/s/,"5",$2)
      print $1"START"$2"END"$3 ; next}'
     1' infile

Maybe with awk and string functions:

awk 'BEGIN{FS="START|END"}
     {gsub(/_this_/,"",$2)
      gsub(/modi/,"MODI",$2)
      gsub(/a/,"4",$2)
      gsub(/s/,"5",$2)
      print $1"START"$2"END"$3}' infile

Maybe with awk and string functions:

awk 'BEGIN{FS="START|END"}
     /START.*END/ {gsub(/_this_/,"",$2)
     gsub(/modi/,"MODI",$2)
     gsub(/a/,"4",$2)
     gsub(/s/,"5",$2)
     print $1"START"$2"END"$3 ; next}
     1' infile
Source Link
FelixJN
  • 14.1k
  • 2
  • 36
  • 55

Maybe with awk and string functions:

awk 'BEGIN{FS="START|END"}
     {gsub(/_this_/,"",$2)
      gsub(/modi/,"MODI",$2)
      gsub(/a/,"4",$2)
      gsub(/s/,"5",$2)
      print $1"START"$2"END"$3}' infile