Thanks, it would have taken me a long time to dare trying sed
, I have better look at it a bit closer.
lpoptions -p xxxx | sed -e 's/ /\n/g'
lpoptions -p xxxx | tr " " "\n"
They seem to deliver the same result on my system.
Inside the string there is one instance of
printer-make-and-model='Brother HL-2060 Foomatic/hpijs-pcl5e'
The 3 spaces gets evaluated, I think because of the single quotes ('). Just in case I checked if (") double quotes would make a difference. Didn't seem to.
Since the long string is a response from the CUPS command I think I am going to leave it and just manually correct if I need to.
Saving the lpoptions -p xxxx to my file 120331-lpop.glk allowed me to do a few quick tests on combinations of ' and " in the string.
tr " " "\n" <120331-lpop.glk >120331-lpop-done.glk Rudge
The break would work fine if I was in control of the line but I am not. CUPS for some reason in the instructions for lpoptions -p xxxx
or lpoptions -d xxxx
(appear to give the same result) do not output the result with new lines, making it hard to read in a hurry. Often it is only 3 lines of interest. If code tags are used the very long line show up. I quote tags are used it is slightly easier to read as no mouse movement needed. In both cases it is a delicate process to do a copy/paste without having to correct content in the buffer.
Having the information based on lines, the copy paste is easier, nor problem with over shooting the mark at the end of a line etc..
The two suggestions I now find however seem to be magical when I run it on my own pc, and I am likely to use them in posts in the future. This leaves me only with the situation where I am copying a 'long line' from Forum, at the moment that is slightly longer way to save it in a file and run the 3rd line.
I am rather happy with what I have got o far as the novelty has worn off parsing those lines.
lpoptions -p xxxx -l
Ah yes, xxxx of course is your printer or printer queue name in http://localhost:631/printers/
Can you resist clicking TBercaht
Thanks, you got me motivated and this works, will save me a lot of work. Regarding not being in this corner, notice we are under supervision here by able practitioners, where better when we are unraveling, to us, command line mysteries.