Link to home
Start Free TrialLog in
Avatar of mzehner
mzehner

asked on

grep

I am using grep to get print options from the same line the name of a printer is found on in a file.  In some files the name of the printer may appear two or more times.  I need to get the option from the line the the name of the printer on the first occurance only.

Is there a way to modify the below line so it will only get one occurance of the printer option?

printtype=`grep -i ${printname} /usr/local/etc/hbspool.conf | cut -f3 -d" "`

Or is there another way to operate on the $printtype variable after its value is set and get the string up to the first whitespace?

Thanks for your help.
ASKER CERTIFIED SOLUTION
Avatar of earthman1968
earthman1968

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SpideyMod
SpideyMod

Force Accepted

SpideyMod
Community Support Moderator @Experts Exchange