Use sed instead of tail
Remove use of 'tail'