Remove the characters from the file

Hi,

I have one file in the following format.

exa_resu_adj.4ge v.47645 PERSONAL INFORMAIONS PVT LTD 31 Dec 2009 04:36 Page 1
 
SALARY REPORT
Account Account Name CCode Bill No Balance T Amt
----------- ------------ ------- ---------- ------------- -------------
17490001 Mr Ram PM 10 1000.00 -1000.00
17490006 Mr Dom AM 10 1000.00 -1000.00
17490003 Mis Pr PM 10 1000.00 -1000.00
-------------
TOTAL : -3000.00
-------------
NUMBER : 3
-------------
-------------
REPORT TOTAL : -3000.00
-------------
TOTAL NUMBER: 3
End of Report Requested by: kattoor

Here I need to remove the following fields

exa_resu_adj.4g3 v.47645
and 
End of Report Requested by: kattoor

Can anybody help me out..?

Thanks in advance..!!

grep -v -e 'exa_resu_adj.4g3 v.47645' -e 'End of Report Requested by: kattoor' "$file"

Or:

awk 'NR>1 && !/^End of Report/' file
sed -e '/exa_resu_adj.*/d' -e '/End of Report.*/d' file 

Be interesting to know which is quicker ?

---edit---

Not much in it :-

xxx@xxx$ time awk 'NR>1 && !/^End of Report/' test >/dev/null

real    0m0.016s
user    0m0.000s
sys     0m0.010s
xxx@xxx$
xxx@xxx$
xxx@xxx$ time sed -e '/exa_resu_adj.*/d' -e '/End of Report.*/d' test >/dev/null

real    0m0.014s
user    0m0.000s
sys     0m0.010s
xxx@xxx$
xxx@xxx$ time /usr/xpg4/bin/grep -v -e 'exa_resu_adj.4g3 v.47645' -e 'End of Report Requested by: kattoor' test >/dev/null

real    0m0.013s
user    0m0.000s
sys     0m0.010s
xxx@xxx$

Thanks for your quick response..!

Here I am facing some more issues in the first line of the file.

I just want to delete the word 'exa_resu_adj.4g3 v.47645' from the first line, the remaining words I need whatever it is.

If am using the above mentioned commands, its removing the entire line itself.

Can anybody help me out on this...?

Try this.

sed 's/exa_resu_adj.4ge v.47645//g' $filename | sed 's/End of Report Requested by: kattoor//g'

Thanks alot....Its working....!!:slight_smile: