Tag Archives: TAV

Replace a whole line with "#"

By saeed.soltani

how can i replace the whole line which start with a specific pattern such as “???”, with a desired string such as “#” i.e:

in-file:

Code:

TAB 20120201 21:02:02
MRD 20121301 22:21:01
??? 201 256
SAS 20123010 12:25:41
MMT 20120102 11:01:12
POP 20120306 02:01:01
??? TAV 2021 333


out-file:

Code:

TAB 20120201 21:02:02
MRD 20121301 22:21:01
#
SAS 20123010 12:25:41
MMT 20120102 11:01:12
POP 20120306 02:01:01
#


Source: FULL ARTICLE at The UNIX and Linux Forums