Sponsored Content
Top Forums Shell Programming and Scripting Searching for similar row(s) across multiple files Post 302676669 by Yoodit on Wednesday 25th of July 2012 03:07:52 AM
Old 07-25-2012
Hello drl,

My question basically is to compare a large number of files and find all the records that exist in more than one file.

Is it possible to do this using sort, uniq and awk or do I need to write a script for the same. Any help would be highly appreciated.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Searching multiple files with multiple expressions

I am using a DEC ALPHA running Digital UNIX (formly DEC OSF/1) and ksh. I have a directory with hundreds of files that only share the extension .rpt. I would like to search that directory based on serial number and operation number and only files that meet both requirements to be printed out. I... (6 Replies)
Discussion started by: Anahka
6 Replies

2. Shell Programming and Scripting

Searching for multiple criteria in log files?

I would like a simple shell script that will allow me to display to screen all unsuccessful su attempts in my sulog file, for the present date. I have been trying several different combinations of commands, but I can't quite get the syntax correct. The mess I have right now (don't laugh) is... (4 Replies)
Discussion started by: Relykk
4 Replies

3. Shell Programming and Scripting

Searching for multiple patterns in files

I have a situation where I need to search for multiple strings (error messages) such as 'aborted' 'file not found' etc in directory having logs. I have put all the error messages in a text file and using the command. grep -f <textfile> <filetobegrepped> I'm doing this thru a script where I... (5 Replies)
Discussion started by: bornon2303
5 Replies

4. Shell Programming and Scripting

Searching a word in multiple files

Hi All, I have a issue in pulling some heavy records , I have my input file has 10,000 records which i need to compare with daily appended log files from (sep 1st 2009 to till date) . I tried to use grep fgrep and even sed , but the as time is factor for me , i cannot wait for 5 days to get the... (3 Replies)
Discussion started by: rakesh_411
3 Replies

5. Shell Programming and Scripting

Searching across multiple files if pattern is available in all files searched

I have a list of pattern in a file, I want each of these pattern been searched from 4 files. I was wondering this can be done in SED / AWK. say my 4 files to be searched are > cat f1 abc/x(12) 1 abc/x 3 cde 2 zzz 3 fdf 4 > cat f2 fdf 4 cde 3 abc 2... (6 Replies)
Discussion started by: novice_man
6 Replies

6. Shell Programming and Scripting

Joining multiple files based on one column with different and similar values (shell or perl)

Hi, I have nine files looking similar to file1 & file2 below. File1: 1 ABCA1 1 ABCC8 1 ABR:N 1 ACACB 1 ACAP2 1 ACOT1 1 ACSBG 1 ACTR1 1 ACTRT 1 ADAMT 1 AEN:N 1 AKAP1File2: 1 A4GAL 1 ACTBL 1 ACTL7 (4 Replies)
Discussion started by: seqbiologist
4 Replies

7. Shell Programming and Scripting

Help converting column to row for multiple files

Hi all, I am pretty new at this so be gentle. Also, if there is any chance you could explain what the code you use is actually doing, that would really help me out, Im learning after all :) So I am trying to convert a selected column of numbers from input file1 into a row in output file2 ... (3 Replies)
Discussion started by: StudentServitor
3 Replies

8. UNIX for Dummies Questions & Answers

Grep in Perl - Searching through multiple files

I'm attempting to use grep in Perl with very little success. What I would like to do in Perl is get the output of the following grep code: grep -l 'pattern' * This gives me a list of all the files in a directory that contain the pattern that was searched. My attempts to do this in Perl... (4 Replies)
Discussion started by: WongSifu
4 Replies

9. Shell Programming and Scripting

Help on searching for a string on multiple files

Hi all, I am sure some gurus will find a better way of doing this. FYI, I've manually modified some of the data 'coz they are somewhat confidential, so there may be some typo errors. At the moment, I have 3 files that I am trying to search for. Sometime in the future, it may go beyond 3... (2 Replies)
Discussion started by: newbie_01
2 Replies

10. BSD

Searching in multiple files

I am new to unix and I would like to search multiple log files to find earliest occurrence of a text. Ex: Say I have 10 logs file each ending with .log and I want to find the text “CustomeError” . I want to find the which log file “CustomeError” comes first and lines which surround’s ... (4 Replies)
Discussion started by: jim john
4 Replies
User manual for old pnm functions(3)			     Library Functions Manual			      User manual for old pnm functions(3)

NAME
libpnm - libnetpbm functions to read and write PNM image files SYNOPSIS
#include <netpbm/pnm.h> void pnm_init( int *argcP, char *argv[] ); xel ** pnm_allocarray( int cols, int rows); xel * pnm_allocrow( int cols); void pnm_freearray( xel **xels, int rows); void pnm_freerow( xel *xelrow); void pnm_readpnminit( FILE *fp, int *colsP, int *rowsP, xelval *maxvalP, int *formatP ); void pnm_readpnmrow( FILE *fp, xel *xelrow, int cols, xelval maxval, int format ); xel ** pnm_readpnm( FILE *fp, int *colsP, int *rowsP, xelval *maxvalP, int* formatP ); void pnm_writepnminit( FILE * fp , int cols, int rows, xelval maxval, int format, int forceplain); void pnm_writepnmrow( FILE *fp, xel *xelrow, int cols, xelval maxval, int format, int forceplain ); void pnm_writepnm( FILE *fp, xel ** xels, int cols, int rows, xelval maxval, int format, int forceplain ); void pnm_nextimage(FILE * file, int * const eofP); void pnm_check( FILE * file, const enum pm_check_type check_type, const int format, const int cols, const int rows, const xelval maxval, enum pm_check_code *retvalP); void pnm_promoteformatrow( xel *xelrow, int cols, xelval maxval, int format, xelval newmaxval, int newformat); void pnm_promoteformat( xel **xels, int cols, xelval maxval, int format, xelval newmaxval, int newformat); xel pnm_whitexel( xelval maxval, int format); xel pnm_blackxel( xelval maxval, int format); void pnm_invertxel( xel *x, xelval maxval, int format); xel pnm_backgroundxelrow( xel *xelrow, int cols, xelval maxval, int format); xel pnm_backgroundxel( xel **xels, int cols, int rows, xelval maxval, int format); typedef ... xelval; typedef ... xel; #define PNM_ASSIGN1(x,v) ... #define PNM_GET1(x) ... #define PNM_EQUAL(x,y) ... #define PNM_FORMAT_TYPE(format) ... DESCRIPTION
These library functions are part of Netpbm(1) TYPES AND CONSTANTS Each xel contains three xelvals, each of which should contain only the values between 0 and PNM_MAXMAXVAL, inclusive. XEL MANIPULATIONS The PNM_GET1 macro extracts a single value from an xel, when ou know it's from a PBM or PGM file. When it's from a PPM file, use PPM_GETR(), PPM_GETG(), and PPM_GETB(). The PNM_ASSIGN1 macro assigns a single value to an xel, when you know it's from a PBM or PGM file. When it's from a PPM file, use PPM_ASSIGN. The PNM_EQUAL macro checks two xels for equality. The PNM_FORMAT_TYPE macro computes a format type code from a format code. The format types are PBM, PGM, PPM, and PAM. But note that PBM, PGM, and PPM each are two different formats: a plain one and a raw one. So there are four format types, but seven formats. PNM_FORMAT_TYPE does not work on the PAM format code. pnm_whitexel() and pnm_blackxel() return a white or black xel, respectively, for the given maxval and format. pnm_invertxel() inverts an xel. INITIALIZATION pnm_init() is identical to pm_proginit. pnm_init() is obsolete. Use pm_proginit() instead. MEMORY MANAGEMENT pnm_allocarray() allocates space for an array of xels. pnm_freearray() frees an array space allocated by pnm_allocarray() or pnm_readpnm(). pnm_allocrow() allocates space for a row of a PNM image. pnm_freerow() frees it. READING PNM FILES pnm_readpnminit() is similar to pnm_readpaminit(), but reads only PNM images and has a different parameter list. pnm_readpnmrow() is similar to pnm_readpamrow() but only works on PNM images and has a different parameter list and returns the row as an array of xels instead of tuples. pnm_readpnm() is similar to pnm_readpam() except that it reads only PNM images and uses a different parameter list and returns an array of rows such that pnm_readpnmrow() would return rather than such that pnm_readpamrow() would return. WRITING FILES pnm_writepnminit() is similar to pnm_writepaminit() except that it can write only a PNM header and has a different parameter list. forceplain is a binary value. True (nonzero) means to write the image in the plain (ASCII) version of the selected format. False (zero) means to write it in the raw (binary) version of the selected format. See PNMformatspecification(5) pnm_writepnmrow() is similar to pnm_writepamrow() except that it works only on PNM images and has a different parameter list and takes an array of xels instead of an array of tuples. See the description of forceplain above. pnm_writepnm() is similar to pnm_writepam() except that it works only on PNM image, has a different parameter list, and takes an array of rows of xels instead of an array of rows of tuples. See the description of forceplain above. FORMAT PROMOTION pnm_promoteformatrow() promotes a row of xels from one maxval and format to a new set. Use this when you are combining multiple anymaps of different types - just take the maximum of the maxvals and the maximum of the formats, and promote them all to that. pnm_promoteformat() promotes an entire anymap. MISCELLANEOUS pnm_nextimage() positions a PNM input file to the next image in it (so that a subsequent pnm_readpnminit() reads its header). pnm_nextimage() is analogous to pbm_nextimage(), but works on PPM, PGM, and PBM files. pnm_check() is similar to pnm_checkpam() except it works only on PNM images. pnm_check() is identical to ppm_check(). pnm_backgroundxelrow() figures out an appropriate background xel based on the row of xels xelrow, which is cols xels wide, has maxval max- val, and represents an image with format format. This estimate works best when the row is the top or bottom row of the image. pnm_backgroundxel() does the same thing as pnm_backgroundxelrow(), except based on an entire image instead of just one row. This tends to do a slightly better job than pnmbackgroundxelrow(). SEE ALSO
Libnetpbm(3) , LibnetpbmUser'sGuide(3) , LibnetpbmDirectory(1) , pbm(5) , pgm(5) , ppm(5) , pam(5) , libpbm(3) , libpgm(3) , libppm(3) AUTHOR
Copyright (C) 1989, 1991 by Tony Hansen and Jef Poskanzer. netpbm documentation 8 September 2007 User manual for old pnm functions(3)
All times are GMT -4. The time now is 02:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy