Sponsored Content
Top Forums Shell Programming and Scripting matching names in 2 text files Post 302349029 by Smiling Dragon on Monday 31st of August 2009 12:29:04 AM
Old 08-31-2009
If you are just wanting to see if all the names liste in the first file are present in the second one:
Code:
for name in `egrep '^(CONTACT PEOPLE:|LEAD:) datafile1 | cut -d ':' -f 2 | sed 's/,/ /g'`
do
  if grep $name datafile2 > /dev/null
  then
    echo "$name validated"
  else
    echo "$name NOT VALIDATED"
  fi
done

(untested - try this somewhere safe and you may need to debug)
egrep is dependent on OS, if it's not present, try substituting with grep -e
 

10 More Discussions You Might Find Interesting

1. AIX

Simultaneous searching for files (names matching certain criteria) in several directo

Hello everyone, My OS is AIX 5.2 I would like some help in getting command syntax that does the following: 1. Searches simultaneously several directories downward; 2. Checks every subdirectory in each directory (and so on...) for file names that contain certain characters such as “~”, start... (0 Replies)
Discussion started by: Hopeful
0 Replies

2. Shell Programming and Scripting

processing file names using text files

Hi, I have to perform an iterative function on a set of 10 files. After the first round the output files are named differently than the input files. examples input file name = xxxx1.yyy output file name = xxxx1_0001.yyy I need to rename all of the output files to the original input... (5 Replies)
Discussion started by: ligander
5 Replies

3. Red Hat

matching emcpower names on both rac nodes

I just ran into issue in linux , i am building oracle rac , i configured everything and turned over to dba , then i found that emcpower* names are not matching in both nodes , i tried to use emcpadm export from master node and emcpadm import on 2 nd node, but all the changes are not... (2 Replies)
Discussion started by: test.com
2 Replies

4. Shell Programming and Scripting

matching and extracting info from text files

Hi all, I have two .txt file i.e. First text file: 2 4 1 4 Second text file 2 1.nii.gz 4 334.nii.gz 1 12.nii.gz 4 134.nii.gz If entry in 1st column of 1st text file matches the 1st column of 2nd text file, then copy the file (name of which is the second column) associated with... (4 Replies)
Discussion started by: vd24
4 Replies

5. Shell Programming and Scripting

Removing matching text from multiple files with a shell script

Hello all, I am in need of assistance in creating a script that will remove a specified block of text from multiple .htaccess files. (roughly 1000 files) I am attempting to help with a project to clean up a linux server that has a series of unwanted url rewrites in place, as well as some... (4 Replies)
Discussion started by: boxx
4 Replies

6. Shell Programming and Scripting

How to remove common file names from text files

I'm running on freebsd -- with a default shell of csh. I have two files named A and B. Each line of each file contains a file name. How can I write a script that removes all the file names in file B from A. I tried to use perl to create a huge regular expression with "|" separating the file... (2 Replies)
Discussion started by: siegfried
2 Replies

7. Shell Programming and Scripting

Removing files with same text but different file names

Hi All, I have some 50,000 HTML files in a directory. The problem is; some HTML files are duplicate versions that is wget crawled them two times and gave them file names by appending 1, 2, 3 etc after each crawl. For example, if the file index.html has been crawled several times, it has been... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

8. Shell Programming and Scripting

How to find empty files in a directory and write their file names in a text?

I need to find empty files in a directory and write them into a text file. Directory will contain old files as well, i need to get the empty files for the last one hour only. (1 Reply)
Discussion started by: vel4ever
1 Replies

9. UNIX for Dummies Questions & Answers

find command: names matching the expression

Hello all, I need to print directories using find command. The directories names contain date in the format YYYYMMDD or the name of directory is only the date format. I want print directories, which doesn't start with this date. E.g I have dirs like foo20120101 foo20120101foo 20120101foo... (1 Reply)
Discussion started by: satin1321
1 Replies

10. Shell Programming and Scripting

Print matching fields (if they exist) from two text files

Hi everyone, Given two files (test1 and test2) with the following contents: test1: 80263760,I71 80267369,M44 80274628,L77 80276793,I32 80277390,K05 80277391,I06 80279206,I43 80279859,K37 80279866,K35 80279867,J16 80280346,I14and test2: 80263760,PT18 80279867,PT01I need to do some... (3 Replies)
Discussion started by: gacanepa
3 Replies
Module::Install::PAR(3) 				User Contributed Perl Documentation				   Module::Install::PAR(3)

NAME
Module::Install::PAR - Module::Install Support for PAR::Dist packages SYNOPSIS
To offer your users the possibility to install binaries if we cannot compile an XS version of the module, you could use this simplistic stub: use inc::Module::Install; name 'Foo'; all_from 'lib/Foo.pm'; # Which CPAN directory do we fetch binaries from? par_base 'SMUELLER'; unless ( can_xs ) { my $okay = extract_par( fetch_par ); if (not $okay) { die "No compiler and no binary package found. Aborting. "; } } WriteAll; DESCRIPTION
This module adds a couple of directives to Module::Install related to installing and creating PAR::Dist distributions. par_base This directive sets the CPAN ID from whose CPAN directory to fetch binaries from. For example, you can choose to download binaries from http://www.cpan.org/authors/id/S/SM/SMUELLER/ or its ftp counterpart by writing: par_base 'SMUELLER'; By default, the name of the file to fetch is generated from the distribution name, its version, your platform name and your perl version concatenated with dashes. The directive, however, takes an optional second argument which specifies the name of the file to fetch. (Though "par_base" does not fetch files itself, see below.) par_base 'SMUELLER', 'foo'; Once "fetch_par" is called, the file 'foo' will be downloaded from SMUELLER's CPAN directory. (It doesn't exist.) The second argument could be used to fetch platform-agnostic binaries: par_base 'SMUELLER', "Some-Distribution-0.01.par"; (Documentation TODO: Use the previously defined distribution name and version in example.) fetch_par Fetches the .par file previously referenced in the documentation of the "par_base" directive. "fetch_par" can be used without arguments given the "par_base" directive was used before. It will return the name of the file it fetched. If the first argument is an URL or a CPAN user ID, the file is fetched from that directory unless an URL has been previously set. (Read that again.) If the second argument is a file name it is used as the name of the file to download. If the file could not be fetched, a suitable error message about no package being available, yada yada yada, is printed. You can turn this off by specifying a true third argument. # Try to fetch the package (see par_base) but # don't be verbose about failures my $file = fetch_par('', '', undef); extract_par Takes the name of a PAR::Dist archive file as first argument. The 'blib/' directory of this archive is extracted and the 'pm_to_blib' is created. Typical shorthand usage: extract_par( fetch_par ) or die "Could not install PAR::Dist archive."; make_par This directive requires PAR::Dist (version 0.03 or up) on your system. (And checks that it is available before continuing.) Creates a PAR::Dist archive from the 'blib/' subdirectory. First argument must be the name of the PAR::Dist archive to create. If your Makefile.PL has a "par_base" directive, the "make par" make target will be available. It uses this "make_par" directive internally, so on your development system, you can do this to create a .par binary archive for your platform: perl Makefile.PL make make par AUTHOR
Audrey Tang <cpan@audreyt.org> With documentation from Steffen Mueller <smueller@cpan.org> COPYRIGHT
Copyright (c) 2006. Audrey Tang. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See <http://www.perl.com/perl/misc/Artistic.html> perl v5.16.3 2012-03-01 Module::Install::PAR(3)
All times are GMT -4. The time now is 10:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy