Need a small script to grep file details from around 2000 files.
Hi,
I have a directory were printer definitions are stored there are more than 2000 printer definitions in it and each printer definition looks as below :- root@segotl0269# cat qpl00361 *------------------------------------------------------------------------* * VPSX Printer definition file (QPL00361) * * Last updated by: Unknown 24 Jul 2012 11:13:43 * *------------------------------------------------------------------------* GRPNAME = BUS ACCT = YES AUTOEJCT = YES COMPRESS = YES COMMTYPE = TCPIP/LPD DEVTYPE = TXT ERRACTN = HOLD MAILCSET = ISO-8859-15 FFSEQ = 0D0C NLSEQ = 0D0A RETAIN = 7 SEPAR = N SEPNAME = default SNMP = YES SNMPCOMM = public TCPHOST = 153.112.40.99 TCPOPTS = 02 TCPPRTR = PRT1 FILTER1 = /opt/lrs/convert1/lrscvdr F1DTYPE = SAPGOF F1ARGS = OTF2PCL &KEYOTF2PCL -i &INFILE -o &OUTFILE -type pcl -profilevar colour=false -logdir &TMPDIR -logfile &PRINTER FILTER2 = /opt/lrs/convert1/lrscvdr F2DTYPE = SAPGOFU F2ARGS = OTF2PCL &KEYOTF2PCL -i &INFILE -profilevar SAPCP=4102 -o &OUTFILE -type pcl -profilevar colour=false -logdir &TMPDIR -logfile &PRINTER EKEY = dynamic EDEVICE = LRSQUEUE ======================================= So i want to grep printer name starting with QFRxxx as prefix with IP address for that printer among 2000 printer definitions in the directory. Thanks in Advance. |
1. show some example output you want
2. looks like the filename is the same as the printer name, so search by filename then grep for the IP (I'm assuming you want the TCPHOST field). 3. write some code and test it; come back if you get stuck and show us your code. In the meantime, you'll want these http://rute.2038bug.com/index.html.gz http://tldp.org/LDP/Bash-Beginners-G...tml/index.html http://www.tldp.org/LDP/abs/html/ |
Can't you simply grep it, as:
Code:
~$ grep 'QFR*' qpl00361 PS: Please use [code][code] around command and output that you share. |
check out this thread:
http://www.linuxquestions.org/questi...e-grep-819347/ or you can use vi editor to search vi qpl00361 :s/QFR/ |
Thanks Chris and Shiva for the suggestion and link..
Going through those :) |
All times are GMT -5. The time now is 09:28 PM. |