Sponsored Content
Top Forums Shell Programming and Scripting Find matched patterns and print them with other patterns not the whole line Post 302918627 by redse171 on Wednesday 24th of September 2014 01:12:33 PM
Old 09-24-2014
Quote:
Originally Posted by shamrock
This should work albeit untested... awk '{for(i=1;i<=NF;i++) if($i ~ "^(IN|OUT)$") print $3,$i,$(i+1)}' file
Hi shamrock,

It worked as expected. I just need to add OFS="\t" at the end. thanks a lot! Smilie

---------- Post updated at 01:12 PM ---------- Previous update was at 01:11 PM ----------

Quote:
Originally Posted by Akshay Hegde
Code:
$ awk  'function p(regex){match($0,regex);return substr($0,RSTART,RLENGTH)}{print p("DSU[0-9]+T[0-9]"),p("(IN|OUT)[[:space:]]+[0-9]")}' file

DSU17281T6 OUT   0
DSU17282T0 OUT   5
DSU17283T0 OUT   0
DSU17284T2 IN   1
DSU16024T3 OUT   1
DSU16025T2 OUT   7
DSU16026T0 IN   3
DSU16027T1 IN   2
DSU16028T0 OUT   2

---------- Post updated at 11:39 PM ---------- Previous update was at 11:34 PM ----------

---

for tab separated fields

Code:
$ awk  'function p(regex){match($0,regex); return substr($0,RSTART,RLENGTH)}{s = p("DSU[0-9]+T[0-9]") FS p("(IN|OUT)[[:space:]]+[0-9]"); gsub(/[[:space:]]+/,OFS,s); print s}' OFS='\t'  file

Hi Akshay Hegde,

It worked perfectly.. Thanks a lot Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

print the next line by searching with different patterns

Hi, I am having an '.xml' file with 'n' number of lines and also having another file with '.txt' format contains values which i want to search. Now I want to print the next line with the pattern which i am searching in '.xml' file. And the loop has to repeat for different patterns which... (5 Replies)
Discussion started by: tejastrikez
5 Replies

2. Shell Programming and Scripting

How to print the next line by searching with different patterns in AIX server?

Hi, I am having an '.xml' file with 'n' number of lines and also having another file with '.txt' format contains values which i want to search. Now I want to print the next line with the pattern which i am searching in '.xml' file. And the loop has to repeat for different patterns which are... (4 Replies)
Discussion started by: tejastrikez
4 Replies

3. Shell Programming and Scripting

Print mutliple patterns in a line using sed

Hi, I am trying to print multiple patterns in a line using sed. But it is printing only the last occurance of a pattern. If the line is the the output should be Lookup Procedure|Stored proc But the output I am getting is Stored proc The code I am using is echo... (9 Replies)
Discussion started by: kedar_laveti
9 Replies

4. Shell Programming and Scripting

Print line between two patterns when a certain pattern matched

Hello Friends, I need to print lines in between two string when a keyword existed in those lines (keywords like exception, error, failed, not started etc). for example, input: .. Begin Edr ab12 ac13 ad14 bc23 exception occured bd24 cd34 dd44 ee55 ff66 End Edr (2 Replies)
Discussion started by: EAGL€
2 Replies

5. Shell Programming and Scripting

Find matched patterns in multiple files

Hi, I need help to find matched patterns in 30 files residing in a folder simultaneously. All these files only contain 1 column. For example, File1 Gr_1 st-e34ss-11dd bt-wwd-fewq pt-wq02-ddpk pw-xsw17-aqpp Gr_2 srq-wy09-yyd9 sqq-fdfs-ffs9 Gr_3 etas-qqa-dfw ddw-ppls-qqw... (10 Replies)
Discussion started by: redse171
10 Replies

6. Shell Programming and Scripting

Find matched patterns in a column of 2 files with different size and merge them

Hi, i have input files like below:- input1 Name Seq_ID NewID Scores MT1 A0QZX3 1.65 277.4 IVO A0QZX3 1.65 244.5 HPO A0QZX3 1.65 240.5 RgP A0Q3PP 5.32 241.0 GX1 LPSZ3S 96.1 216.9 MEL LPSS3X 4.23 204.1 LDD LPSS3X 4.23 100.2 input2 Fac AddName NewID ... (9 Replies)
Discussion started by: redse171
9 Replies

7. Shell Programming and Scripting

Matched multiple patterns that could be in a same line

Hi, I need help to match pattern started with "RW" in file 1 and with pattern in $1 in file 2 as follows:- File 1 BH /TOTAL=466(423); /POSITIVE=300(257); /UNKNOWN=25(25); BH /F_P=141(141); /F_N=136; /P=4; CC /TAX=!?; /MAX-R=2; CC /VER=2; RW P9610, AR_BSU , T; PAE25, AE_E57... (10 Replies)
Discussion started by: redse171
10 Replies

8. Shell Programming and Scripting

How to print line if two lines above it matches patterns.?

Hi, I could only find examples to print line before/after a match, but I'd need to print line after two separate lines matching. E.g.: From the below log entry, I would need to print out the 1234. This is from a huge log file, that has a lot of entries with "CLIENT" and "No" entries (+ other... (3 Replies)
Discussion started by: Juha
3 Replies

9. Shell Programming and Scripting

How to print two matched patterns only from each line?

My input looks like this. # Lot Of CODE Before AppType_somethinglese=$(cat << EOF AppType_test1='test-tool/blatest-tool-ear' AppType_test2='test/blabla-ear' # Lot Of CODE After I want to print text betwen 1) _ and = and 2)/ and ' from each line and exclude lines with "EOF". Output... (2 Replies)
Discussion started by: kchinnam
2 Replies

10. Shell Programming and Scripting

Bash - Find files excluding file patterns and subfolder patterns

Hello. For a given folder, I want to select any files find $PATH1 -f \( -name "*" but omit any files like pattern name ! -iname "*.jpg" ! -iname "*.xsession*" ..... \) and also omit any subfolder like pattern name -type d \( -name "/etc/gconf/gconf.*" -o -name "*cache*" -o -name "*Cache*" -o... (2 Replies)
Discussion started by: jcdole
2 Replies
sane-teco1(5)						   SANE Scanner Access Now Easy 					     sane-teco1(5)

NAME
sane-teco1 - SANE backend for TECO / RELISYS scanners DESCRIPTION
The sane-teco1 library implements a SANE (Scanner Access Now Easy) backend that provides access to some TECO SCSI flatbed scanners. This backend should be considered beta-quality software! TECO scanners are sold under various brands like RELISYS, PIOTECH, TRUST. This backend may or may not support yours. The scanners that should work with this backend are: Vendor Model TECO model status ---------------------- -------------- ----------- Relisys AVEC 2400 VM3520 tested Relisys AVEC 2412 VM3520+ tested Relisys AVEC 4800 VM4530 untested Relisys AVEC 4816 VM4530+ untested Relisys RELI 2400 VM3530 untested Relisys RELI 2412 VM3530+ tested Relisys RELI 2412 VM3530+ untested Relisys RELI 4816 VM4540 tested Relisys RELI 4830 VM4542 tested Relisys RELI 9600 VM6530 untested Relisys RELI 9612 VM6530* untested Relisys RELI 9624 VM6530+ untested Relisys RELI 9630 VM6540 untested Relisys RELI DS15 VM3440 untested Relisys RELI DS6 VM3420 untested Dextra DF-600P VM3510 tested Dextra DF-4830T VM4542 untested Dextra DF-1200T+ VM3530+ untested Dextra DF-9624 VM6530+ untested Note that the untested scanner will not be directly supported. You should contact the author for that. The TECO VM number can usually be found at the back of the scanner. It is also part of the FCC ID. "sane-find-scanner -v" will also show the scsi inquiry, and if it is a TECO scanner, the name will be there too. The options the backend supports can either be selected through command line options to programs like scanimage or through GUI elements in xscanimage or xsane. If you have any success with a scanner not listed here, or if you have any strange behavior, please report to the backend maintainer or to the SANE mailing list. Valid command line options and their syntax can be listed by using scanimage --help -d teco1 Scan Mode --mode selects the basic mode of operation of the scanner valid choices are Black & White , Grayscale and Color The Black & White mode is black and white only (1 bit). Grayscale will produce 256 levels of gray (8 bits). Color will produce a 24 bits color image. --resolution selects the resolution for a scan. The scanner can do all resolutions between 1 and 600, in increments of 1. Geometry options -l -t -x -y control the scan area: -l sets the top left x coordinate, -t the top left y coordinate, -x selects the width and -y the height of the scan area. All parameters are specified in millimeters by default. Enhancement options --custom-gamma (color mode only) allows the user to specify a gamma table (see the next 3 parameters). --red-gamma-table (color mode only) can be used to download a user defined gamma table for the red channel. The table must be 256 bytes long. --green-gamma-table (color mode only) can be used to download a user defined gamma table for the green channel. The table must be 256 bytes long. --blue-gamma-table (color mode only) can be used to download a user defined gamma table for the blue channel. The table must be 256 bytes long. --dither (Black & White only) select the dither mask to use. Possible values are Line art , 2x2 , 3x3 , 4x4 bayer , 4x4 smooth , 8x8 bayer , 8x8 smooth , 8x8 horizontal and 8x8 vertical --preview requests a preview scan. The resolution used for that scan is 22 dpi and the scan area is the maximum allowed. The scan mode is user selected. The default is "no". CONFIGURATION FILE
The configuration file /etc/sane.d/teco1.conf supports only one information: the device name to use (eg /dev/scanner). FILES
/usr/lib64/sane/libsane-teco1.a The static library implementing this backend. /usr/lib64/sane/libsane-teco1.so The shared library implementing this backend (present on systems that support dynamic loading). ENVIRONMENT
SANE_DEBUG_TECO1 If the library was compiled with debug support enabled, this environment variable controls the debug level for this backend. E.g., a value of 128 requests all debug output to be printed. Smaller levels reduce verbosity. LIMITATIONS
The windows TWAIN driver has many more options than this SANE backend. However they are only software adjustments. This backend only imple- ments what the scanner can support. BUGS
None known. SEE ALSO
sane-scsi(5), scanimage(1), xscanimage(1), xsane(1), sane(7) AUTHOR
The package is actively maintained by Frank Zago. http://www.zago.net/sane/#teco CREDITS
Thanks to Gerard Delafond for the VM4542 support. Thanks to Jean-Yves Simon for the VM3510 support. 14 Jul 2008 sane-teco1(5)
All times are GMT -4. The time now is 02:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy