There is no command that will do that. There are lots of commands that can do part of it, so you can put those commands together and your problem is solved. So, you need to break the problem down into parts and then solve each part individually. Once you've done that, you've inherently solved the whole.
The first thing you need to do is open the file, and then you need to read the data in the file. Exactly how you do that depends on the format of the data in the file. ".dat" is just a generic file extension for a data file. It tells us nothing about exactly what's in the file, so you have to do that.