Sponsored Content
Top Forums Shell Programming and Scripting Ksh: how compare content of a file with an other array Post 302913487 by rbatte1 on Sunday 17th of August 2014 03:12:05 PM
Old 08-17-2014
Welcome jmartin,
I have a few to questions pose in response first:-
  • Is this homework/assignment? There are specific forums for these.
  • What have you tried so far?
  • What output/errors do you get?
  • What OS and version are you using?
  • What are your preferred tools? (C, shell, perl, awk, etc.)
  • What logical process have you considered? (to help steer us to follow what you are trying to achieve)
Most importantly, What have you tried so far?

There are probably many ways to achieve most tasks, so giving us an idea of your style and thoughts will help us guide you to an answer most suitable to you so you can adjust it to suit your needs in future.


We're all here to learn and getting the relevant information will help us all.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

compare array contents with file

I have an array "arrA" with the following contents: A0012 Paint Shop.doc ES001 Contract Signature.doc Budget Plan.pdf TS PWS.pdf My data file "Files.dat" has the same contents: A0012 Paint Shop.doc ES001 Contract Signature.doc Budget Plan.pdf TS PWS.pdf I have a script that compares... (0 Replies)
Discussion started by: orahi001
0 Replies

2. Shell Programming and Scripting

file content in an array PERL

Hello everybody, I'm new in this forum. I searched a long time for a solution for my problem but I didn't find the right thing. I have to read from a file (content is "abngjm" without any other signs) and have to write this content in an array. But every sign has to be called by its own... (5 Replies)
Discussion started by: e_prof
5 Replies

3. Shell Programming and Scripting

KSH to group records in a file and compare it with another file

Hi, I've a file like below: DeptFile.csv DeptID EmpID ------- ------ Dep01 Emp01 Dep01 Emp02 Dep01 Emp03 Dep02 Emp04 Dep02 Emp05 I've another file which has EmpFile.csv EmpID Salary ------ ------ (3 Replies)
Discussion started by: Matrix2682
3 Replies

4. Shell Programming and Scripting

KSH: Compare variable to $1 in an input file

Hello, I am working with KSH on AIX and I have 2 files generated from different sources... as seen below: FILE1 FILE2 AAA AAA@ABS0001C BBB BBB@ABS0003D CCC CCC@ABS0023A DDD DDD@ABC0145D EEE EEE@ABS0090A FFF FFF@ABS0002A GGG GGG@ABC0150D HHH FILE1 is main main data source,... (4 Replies)
Discussion started by: right_coaster
4 Replies

5. Shell Programming and Scripting

Print @array content to a file

Hi, as the title, I have an array @f_lines with gene information in it. How can I put the content of @f_lines into a file so that I can read it? I tried this: open(OUTPUT, "file"); # put gene information in this file; @f_lines = ("gene1", "gene2", "gene3"...); # gene information; print... (3 Replies)
Discussion started by: lyni2ULF
3 Replies

6. Shell Programming and Scripting

Compare file to array, replace with corresponding second array

ok, so here is the issue, I have 2 arrays. I need to be able to create a loop that will find ${ARRAY1 in the text doc, and replace it with ${ARRAY2 then write the results. I already have that working. The problem is, I need it to do that same result across however many items are in the 2... (2 Replies)
Discussion started by: gentlefury
2 Replies

7. Shell Programming and Scripting

File names as array element in ksh

Hi, I have an ksh array(ARR). the elements to the array are file names. i need to go to each file in the array and manipulate the records. for name in ${files}; do ---this loop is for all the file names in the array for i in $(wc -l < $name); do --this loop is for all the records in... (20 Replies)
Discussion started by: usrrenny
20 Replies

8. Shell Programming and Scripting

Compare two folders and file content

Hi, I am having two folders where i need to compare the content of files and also to know if any new files been added and redirect the difference output in respective filename logs. For e.g.: Directory D1: f1 f2 f3 Directory D2: f1 f2 f3 f4 i Need to compare the directories... (25 Replies)
Discussion started by: rohit_shinez
25 Replies

9. Shell Programming and Scripting

Compare & print content of file which is not matching

Hi All I want to compare 2 files using awk and get output of content which is not matching I have 2 files a.txt 123 456 780 143 b.txt A|B|C|167|D|E C|K|D|123|D|E A|B|D|789|G|F C|D|G|143|A|B Not matching line from b.txt O/P A|B|C|167|D|E A|B|D|789|G|F (3 Replies)
Discussion started by: aaysa123
3 Replies

10. Shell Programming and Scripting

ksh scripting SSH to Compare File Sizes

Hello, I currently have very little experience with Shell scripting and trying to create a script for the purpose of collecting the size of a couple sizes on 4 different Hosts. The Idea is to collected the information from the files in which the script is kicked off on, store the values into... (17 Replies)
Discussion started by: Abstract3000
17 Replies
lib(3perl)						 Perl Programmers Reference Guide						lib(3perl)

NAME
lib - manipulate @INC at compile time SYNOPSIS
use lib LIST; no lib LIST; DESCRIPTION
This is a small simple module which simplifies the manipulation of @INC at compile time. It is typically used to add extra directories to perl's search path so that later "use" or "require" statements will find modules which are not located on perl's default search path. Adding directories to @INC The parameters to "use lib" are added to the start of the perl search path. Saying use lib LIST; is almost the same as saying BEGIN { unshift(@INC, LIST) } For each directory in LIST (called $dir here) the lib module also checks to see if a directory called $dir/$archname/auto exists. If so the $dir/$archname directory is assumed to be a corresponding architecture specific directory and is added to @INC in front of $dir. lib.pm also checks if directories called $dir/$version and $dir/$version/$archname exist and adds these directories to @INC. The current value of $archname can be found with this command: perl -V:archname The corresponding command to get the current value of $version is: perl -V:version To avoid memory leaks, all trailing duplicate entries in @INC are removed. Deleting directories from @INC You should normally only add directories to @INC. If you need to delete directories from @INC take care to only delete those which you added yourself or which you are certain are not needed by other modules in your script. Other modules may have added directories which they need for correct operation. The "no lib" statement deletes all instances of each named directory from @INC. For each directory in LIST (called $dir here) the lib module also checks to see if a directory called $dir/$archname/auto exists. If so the $dir/$archname directory is assumed to be a corresponding architecture specific directory and is also deleted from @INC. Restoring original @INC When the lib module is first loaded it records the current value of @INC in an array @lib::ORIG_INC. To restore @INC to that value you can say @INC = @lib::ORIG_INC; CAVEATS
In order to keep lib.pm small and simple, it only works with Unix filepaths. This doesn't mean it only works on Unix, but non-Unix users must first translate their file paths to Unix conventions. # VMS users wanting to put [.stuff.moo] into # their @INC would write use lib 'stuff/moo'; NOTES
In the future, this module will likely use File::Spec for determining paths, as it does now for Mac OS (where Unix-style or Mac-style paths work, and Unix-style paths are converted properly to Mac-style paths before being added to @INC). If you try to add a file to @INC as follows: use lib 'this_is_a_file.txt'; "lib" will warn about this. The sole exceptions are files with the ".par" extension which are intended to be used as libraries. SEE ALSO
FindBin - optional module which deals with paths relative to the source file. PAR - optional module which can treat ".par" files as Perl libraries. AUTHOR
Tim Bunce, 2nd June 1995. "lib" is maintained by the perl5-porters. Please direct any questions to the canonical mailing list. Anything that is applicable to the CPAN release can be sent to its maintainer, though. Maintainer: The Perl5-Porters <perl5-porters@perl.org> Maintainer of the CPAN release: Steffen Mueller <smueller@cpan.org> COPYRIGHT AND LICENSE
This package has been part of the perl core since perl 5.001. It has been released separately to CPAN so older installations can benefit from bug fixes. This package has the same copyright and license as the perl core. perl v5.14.2 2014-09-29 lib(3perl)
All times are GMT -4. The time now is 09:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy