Using stdin as an input file
This is just a quick example I whipped up, it isn’t an actual situation where you might use it and wget might even take stdin for urls.
Lets say you have a html file you want to download all of the mp3s from so you run the following command to get the urls
[21:41:33][user@host ~]$ cat index.html | sed -e 's/"/\n/g' | egrep '^http.*\.mp3$'
http://www.greatestsiteever.com/song.mp3
http://www.goodmusic.com/goody.mp3
http://www.badmusic.com/bad.mp3
...
The thing is that you don’t want to write those urls to a file on the drive because you just don’t want the clutter.
Enter /dev/stdin
[21:45:48][user@host ~]$ cat index.html | sed -e 's/"/\n/g' | egrep '^http.*\.mp3$' | wget -i /dev/stdin
--21:45:49-- http://www.greatestsiteever.com/song.mp3
Resolving www.greatestsiteever.com... 10.10.10.1
Connecting to www.greatestsiteever.com|10.10.10.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `song.mp3'
[ <=========================================================> ] 3,443,012 1832.5K/s in 2.2s
21:45:51 (1832.5 KB/s) - `song.mp3' saved [43012]
FINISHED --21:45:51--
Downloaded: 1 files, 3.28M in 2.2s (1832.5 KB/s)
......
This technique can be very handy depending on the type of work you are doing. If you are needing to pass a configuration file to an application and the filesystem is read only or you don’t want to actually write the config to the filesystem or any situation where a command needs an input file and you don’t want to create any files.
