Wikipedia:Reference desk/Archives/Computing/2015 December 12

= December 12 =

How do I add a printer?
How do I add a printer on Windows 7? — Preceding unsigned comment added by Mikemohr44 (talk • contribs) 04:35, 12 December 2015 (UTC)


 * see here 199.19.248.76 (talk) 05:16, 12 December 2015 (UTC)


 * How I do it is plug in the printer (both power cord and USB cord to the PC), and turn it on. The PC then detects the printer and offers to search for a driver, but NEVER finds one.  I then do my own web search for a driver, download and install that, then it works.  Some printers come with an install disk, in which case that's another possibility, although it might not have the latest updates and fixes.  Note that this does not apply to installing a network printer, only a standalone. StuRat (talk) 06:47, 12 December 2015 (UTC)


 * Some printers come with a CD or DVD. RTFM, most of the printers conncected to USB port, requires to run setup first, making the OS know the device. Printers on a network needs frist to get an IP address. Setup is scanning for known priters. If You have the driver only, You need to use fixed IP settings (no DHCP/BOOTP), define a local LPR port in the procedure of adding the printer. In Windows a network port requires a server computer which might be a workstation with the printer shared on the network. A local network port is requred if there are no other computers in the network or the printer access should not be depending on other computers or You want this this computer to be the windows print server for this printer in this network. -- Hans Haase (有问题吗) 15:27, 12 December 2015 (UTC)

Confused about sed syntax
The sed examples I know are mostly in the form: sed s/text/newtext/ file.txt However, I see that: sed -i '1i prepend this' file.txt works, producing the same result as: sed -i '1i\prepend this' file.txt Why does the man pages talks about i \, when i alone also works? Why are the options within the string? Why aren't they as a flag to the command. I imagine something like: sed  "string" filename But when I find something like: sed "insert string" filename I wonder why aren't the insert and string separated? --3dcaddy (talk) 19:24, 12 December 2015 (UTC)


 * Your examples of the i command don't work in standard sed. They work in GNU sed, which is what you're probably using, and maybe some other seds. GNU sed lets you play fast and loose with the syntax, and stick text on the same line as an a, c, or i command, because it makes it easier to do a one-line command like yours. In POSIX, the a, c, and i commands must be followed by a \ and then a newline. sed is ancient, and its syntax is extremely picky and terse. It was designed for use on teletypes in the computer labs of yore. You would be expected to be familiar with the documentation. So, you would know that all sed commands are one letter, and that \ is used in Unix for line continuation, so you would know to use \ to tell sed that your text is on the following line. The man pages for sed and a lot of other utilities are not good places to learn how to use them. They're more intended for quick reference when you already know how to use the program. For learning sed, I suggest these:
 * 
 * 


 * And there's the sed article, which also has some more links. --71.119.131.184 (talk) 21:31, 12 December 2015 (UTC)


 * The syntax requiring multiple lines may make more sense if you consider that it was derived from ed, where the insertion commands a and i were the way you'd switch into text-entry mode. Having done so, you would often type in many lines of text at a time, until you needed to go back and edit something.  (Remember, this is in a teletype-style environment.)  So, similarly, the i command in sed allows you to enter many lines:


 * If you're writing something like that, it looks better without the i cluttering up the first line of the insertion. --76.69.45.64 (talk) 04:02, 13 December 2015 (UTC)