The grep -v "^$" is NOT just a sanity thing. It is a waste of system resources that only serves to make your script run slower. Any line that is matched by the first grep in your pipeline can't possibly be an empty line that will be discarded by the second grep in your pipeline. The cat in your pipeline is an unnecessary use of cat. It, again, only serves to make your script run slower.
The following script produces the same output as your script. But, of course, it depends on your sample input being a realistic sample of the actual contents of /tmp/x.txt. If it isn't, all bets are off.
awk 'sub(/^.*xx_tmp/, "xx_tmp")' /tmp/x.txt
The Following User Says Thank You to Don Cragun For This Useful Post: