improve performance - replace $\| with $#@ and remove header and trailer records

Hi All,

In my file i need to remove header and trailer records which comes in 1st line and last line respectively. After that i need to replace '$\|' with '$#@'.
I am using sed command for this and its taking lot of time. Is there any other command which can be used to improve performance?

Thanks in Advance,

You are unlikely to find anything faster than sed.

sed -e '1d' -e '$d' -e 's/$\\|/$#@/g' "$file"