about an argument with variable in sed

hi all

let say I run the ./xxx.bash x x x x or ./xxx.bash x x x or ./xxx.bash x x x x x
the last argument always a filename
the last arugment filename format is 5-10-22.txt
my question is how can I put this arugment into variable and I can use it in sed or any other way that i can use

I have tried use the following commands but not work
var=$#

sed -n '/xxxxx/p' \$$var > xxx

thank all

$# : number of parameters passed to the script (or function)
If you want the last one :
GNU bash, version 4.1.5(1)-release

echo ${!#}