Can you limit the compare on "comm" command


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Can you limit the compare on "comm" command
# 1  
Old 03-23-2007
Can you limit the compare on "comm" command- ANSWER FOUND PLEASE IGNORE.

I need to find deleted records from a file. I compare yesterdays file.old to todays file.new. I need to find the records that were in yesterdays file that are not in todays. My file is fixed field. If I run a "comm -23" obviously what i find is not necesarilly a delete, it could be a change.

The first 10 characters of each line are always static. So my option is to cut the first 10 chars from each file into seperate fiels. COmpare these seperate files. That way I find true delete records. Problem is I need the rest of the record that I cut off. I know I can somehow creatively use awk and grep to rebuild these, but I was wondering:

Is there an option to pass to the com command to tell it to only compare the frist 10 characters of each line inmy 2 files? Thus making all the extra work not necessary.

Thank you.

I figured out a way to do this. thank you all for viewing the message.

Last edited by eja; 03-28-2007 at 11:21 AM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

2. UNIX for Beginners Questions & Answers

Extract delta records using with "comm" and "sort" commands combination

Hi All, I have 2 pipe delimited files viz., file_old and file_new. I'm trying to compare these 2 files, and extract all the different rows between them into a new_file. comm -3 < sort file_old < sort file_new > new_file I am getting the below error: -ksh: sort: cannot open But if I do... (7 Replies)
Discussion started by: njny
7 Replies

3. Red Hat

Postfix keeps returning "Command time limit exceeded" message

We are having issues with our Postfix. The POP and IMAP services randomly stops working an sent e-mails return a "Command time limit exceeded". We've found out that running these command fix the problem: service cyrus-imapd stop rm /var/lib/imap/tls_sessions.db* rm... (2 Replies)
Discussion started by: GustavoAlvarado
2 Replies

4. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

5. UNIX for Dummies Questions & Answers

Unix "look" Command "File too large" Error Message

I am trying to find lines in a text file larger than 3 Gb that start with a given string. My command looks like this: $ look "string" "/home/patrick/filename.txt" However, this gives me the following message: "look: /home/patrick/filename.txt: File too large" So, I have two... (14 Replies)
Discussion started by: shishong
14 Replies

6. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

7. Shell Programming and Scripting

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

8. UNIX for Advanced & Expert Users

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

9. UNIX for Dummies Questions & Answers

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

10. Shell Programming and Scripting

Problems in "comm"

With respect to my other query I was trying to compare the data in files with "comm" command. File -1: (InCU_notDB) EP120307602281841 EP120607602631482 EP120607602631483 EP120607602631484 EP120607602631485 EP120607602631486 EP120607602631487 EP092905800544601 EP071708601490636... (4 Replies)
Discussion started by: swame_sp
4 Replies
Login or Register to Ask a Question
ZZIP_DISK_FINDFILE(3)					       zziplib Function List					     ZZIP_DISK_FINDFILE(3)

NAME
zzip_disk_findfile, zzip_disk_findfirst, zzip_disk_findnext, zzip_disk_findmatch - search for files in the (mmapped) zip central directory SYNOPSIS
#include <zzip/mmapped.h> struct zzip_disk_entry * zzip_disk_findfile(( ZZIP_DISK * disk, char *filename, struct zzip_disk_entry *after, zzip_strcmp_fn_t compare)); struct zzip_disk_entry * zzip_disk_findfirst((ZZIP_DISK * disk)); struct zzip_disk_entry * zzip_disk_findnext(( ZZIP_DISK * disk, struct zzip_disk_entry *entry)); struct zzip_disk_entry * zzip_disk_findmatch(( ZZIP_DISK * disk, char *filespec, struct zzip_disk_entry *after, zzip_fnmatch_fn_t compare, int flags)); DESCRIPTION
The zzip_disk_findfile function is given a filename as an additional argument, to find the disk_entry matching a given filename. The compare-function is usually strcmp or strcasecmp or perhaps strcoll, if null then strcmp is used. - use null as argument for "after"-entry when searching the first matching entry, otherwise the last returned value if you look for other entries with a special "compare" function (if null then a doubled search is rather useless with this variant of _findfile). The zzip_disk_findfirst function is the first call of all the zip access functions here. It contains the code to find the first entry of the zip central directory. Here we require the mmapped block to represent a real zip file where the disk_trailer is _last_ in the file area, so that its position would be at a fixed offset from the end of the file area if not for the comment field allowed to be of variable length (which needs us to do a little search for the disk_tailer). However, in this simple implementation we disregard any disk_trailer info telling about multidisk archives, so we just return a pointer to the zip central directory. For an actual means, we are going to search backwards from the end of the mmaped block looking for the PK-magic signature of a disk_trailer. If we see one then we check the rootseek value to find the first disk_entry of the root central directory. If we find the correct PK-magic signature of a disk_entry over there then we assume we are done and we are going to return a pointer to that label. The return value is a pointer to the first zzip_disk_entry being checked to be within the bounds of the file area specified by the arguments. If no disk_trailer was found then null is returned, and likewise we only accept a disk_trailer with a seekvalue that points to a disk_entry and both parts have valid PK-magic parts. Beyond some sanity check we try to catch a common brokeness with zip archives that still allows us to find the start of the zip central directory. The zzip_disk_findnext function takes an existing disk_entry in the central root directory (e.g. from zzip_disk_findfirst) and returns the next entry within in the given bounds of the mmapped file area. The zzip_disk_findmatch function uses a compare-function with an additional argument and it is called just like fnmatch(3) from POSIX.2 AD:1993), i.e. the argument filespec first and the ziplocal filename second with the integer-flags put in as third to the indirect call. If the platform has fnmatch available then null-compare will use that one and otherwise we fall back to mere strcmp, so if you need fnmatch searching then please provide an implementation somewhere else. - use null as argument for "after"-entry when searching the first matching entry, or the last disk_entry return-value to find the next entry matching the given filespec. AUTHOR
o Guido Draheim <guidod@gmx.de> COPYRIGHT
Copyright (c) 2003,2004,2006 Guido Draheim All rights reserved, use under the restrictions of the Lesser GNU General Public License or alternatively the restrictions of the Mozilla Public License 1.1 zziplib 0.13.56 ZZIP_DISK_FINDFILE(3)