I need to remove header(H) and trailer(T) from a file keeping other records as such.
The source file will look as below
I have to remove
H|20120203_000500|20120203_000500 and
T| 10111246
from the above file. Please let me know how to do...
I need to remove header(H) and trailer(T) from a file keeping other records as such.
The source file will look as below
I have to remove
H|20120203_000500|20120203_000500 and
T| 10111246
from the above file. Please let me know how to do...
sed '/^[HT]/d' file
Guru.
sed -i '/^H|\|^T|/d' infile
--ahamed
$ egrep -v "^H|^T" test.txt
D|373652879|34511433|0|0|0|0|0|40853|1336|e48999|OR|Save Original Line|
D|373652881|2698|0|0|0|0|0|40853|1336|e48999|OR|Save Original Line|
D|373652883|9589|0|0|0|0|0|40853|1336|e48999|OR|Save Original Line|
D|373652885|3427|0|0|0|0|0|40853|1336|e48999|OR|Save Original Line|
D|373652887|33146774|0|0|0|0|0|40853|1336|e48999|OR|Save Original Line|
D|373652889|33866498|0|0|0|0|0|40853|1336|e48999|OR|Save Original Line|
When I tried the above command i got
Any idea why???
your sed is not supporting the -i option.
then you can redirect the output to new file.
sed '/^H|\|^T|/d' infile > outfile
worked fine... thanks guruprasadpr