Import ASCII from a webpage

Hi

I would like to read an ASCII-file stored on a webpage (e.g. somepage.ch/asccii.txt) and process it with root. Since I use windows there is no command available like curl or wget and, anyway, I would like to find a platform independant solution. I found a similar request here in the forum:

Since this is from 2011 maybe now there is another way to import data from the web?

Best regards,
delos

to introduce myself: I am a physicist working at PSI, Switzerland.

Hi,

Try:powershell -NoProfile -Command "(new-object System.Net.WebClient).DownloadFile('http://www.somepage.ch/asccii.txt', 'ascii.txt')" And this can be used in a batch script as well.

Cheers, Bertrand.

Hi bellenot

Thanks a lot! This works for windows only, right?

Cheers,
delos

Hi,

Yes. On other platforms you can use wget.

Cheers, Bertrand.

Hi,
There is a Windows port of wget. Check out the package UnxUtils:
http://unxutils.sourceforge.net/
It includes several other useful commands (grep, wc, etc.) Simply extract the files to some folder and run them from there (or add that folder to the path) inside a command prompt window. You don’t even have to extract all the files, only the ones you want.
Note that you may need to get also the msvcrt.dll file if you don’t have it already; just try the utils and if there are no errors you already have the dll. You can read more about it on this site, although I don’t know if it’s the same wget as in UnxUtils (at least it is a newer version):
http://gnuwin32.sourceforge.net/packages/wget.htm
With this, you can basically use the same command on all platforms; these ports even accept the normal slash to navigate subfolders linux-style :slight_smile:
Cheers,
Daniel

Thanks Daniel

I’ll keep that in mind.

Cheers,
delos