Get a printer name into variable with similar printers


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Get a printer name into variable with similar printers
# 8  
Old 02-20-2019
Quote:
Originally Posted by RudiC
... I don't have your printer.conf around for testing.
# 9  
Old 02-20-2019
Quote:
<Printer BIXOLON>
UUID urn:uuid:6b4abb5d-c3b3-3eee-4923-a6128aefe38a
Info BIXOLON SRP-350II
Location test1
DeviceURI usb://BIXOLON/SRP-350II?serial=00000001
so this is a small portion of it. If you can see Printer is 4 lines below our matched text 350II. In some workostation is 4 below,. some 5, etc.
So maybe idea is to find <printer below it, and then with sed or awk get just BIXOLON. Some pseudocode maybe is: Find printer tag below matched string.
# 10  
Old 02-20-2019
It's always helpful to show consistent, and sufficient, sample data. In your sample in post #9, I can't see "CiTIZEN" nor "S310II" matched as requested in post #1. The "<Printer BIXOLON>" line is two or four lines BEFORE a match of "35011", and it wouldn't be more specific that "CITIZEN", which, as I can see in post #1, wouldn't satisfy your request.
I you want a generic (taylored?) solution, please post
- different input samples, i.e. different printers.conf
- the specific data (line / field / composed string) you want from either
- the match you want to supply for either search.
# 11  
Old 02-20-2019
yeah, u are right. This is just a test. So what is matched string and name is irelevant. Point must be the same. Find the model, this is what is string check. When find, ok it is here, find printer name. So if I search just CITIZEN, and have similar printers, it comming confused. What is the point? I use printer for something else. So I use printer name. Very important to find model which I have and want to use. I have several printers usb so I don't use that. Good example is CT-S310II, so i want that, but nevermind that is irelevant as i said ealrier.
Point #2 is that when I find S3100 in printers.conf, find FIRST <printer tag, without that, only to leave a name, but that I will do with awk, just dont know how to find that first line <Printer below matched string S3100.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

To find ls of similar pattern files in a directory by passing the variable.

Hi, I have file in my $datadir as below :- SAT_1.txt SAT_2.txt BAT_UD.lst BAT_DD1.lst DUTT_1.txt DUTT_la.txt Expected result :- should get all the above file in $<Filename>_file.lst Below is my code :- for i in SAT BAT DUTT do touch a.lst cd $datadir (1 Reply)
Discussion started by: satishmallidi
1 Replies

2. Shell Programming and Scripting

Perl match multiple numbers from a variable similar to egrep

I want to match the number exactly from the variable which has multiple numbers seperated by pipe symbol similar to search in egrep.below is the code which i tried #!/usr/bin/perl my $searchnum = $ARGV; my $num = "148|1|0|256"; print $num; if ($searchnum =~ /$num/) { print "found"; }... (2 Replies)
Discussion started by: kar_333
2 Replies

3. Linux

Find printer location and printer type

Hi, Is it possible to find the printer location and printer type (whether it is local or network) using command in Linux ? Thanks in advance. (1 Reply)
Discussion started by: forumguest
1 Replies

4. Shell Programming and Scripting

Using sed (or similar) to rename variable headings

Hello, I'm rather new to the world of regular expressions and sed, though am excited by its possibilities. I have a particular task I'd like to achieve, and have googled the topic quite a bit. However, having found some codes that perform a task very similar to what I'd like to do, I can't for... (2 Replies)
Discussion started by: redseventyseven
2 Replies

5. AIX

Check printer queue on Windows printer server

Hello Let me first give a small overview of the setup. All printers are connected to Windows 2000 servers. There are a lot of UNIX (AIX & HP-UX) servers as well which have SAP running. I'm working on a script to add printers to a specified SAP instance. I want to verify the user input (to... (0 Replies)
Discussion started by: NielsV
0 Replies

6. Solaris

Configuring Printer with Printer Manager

Hi All, I am trying to configure printer in solaris 10 with the help of print manager. There is no printer attached to my system, ia m doing it for test purpose. However I am unable to do so coz its pops up window - Heading as error with option as dismiss and cancel. Kindly help as I am... (3 Replies)
Discussion started by: kumarmani
3 Replies

7. Linux

know I do for to printer in printer deskjet 80colun

I want to print some thing in HP Deskjet 692.? (1 Reply)
Discussion started by: edvaldo
1 Replies

8. UNIX for Dummies Questions & Answers

Printers

I'm in need of finding out on how to mount and dismount printers. Thx, shawnnee (1 Reply)
Discussion started by: shawnnee
1 Replies
Login or Register to Ask a Question