Sponsored Content
Top Forums Shell Programming and Scripting need to print the missing lines in 1 file from 1 file via script Post 302426605 by dazdseg on Wednesday 2nd of June 2010 09:43:46 AM
Old 06-02-2010
i have done a lil bit of modification. i am not checking this for different directories. i have pasted both the files in same directory and doing it ... see the below script. (i m pasing my script as u said.. sorry for late response)

Code:
#!/usr/bin/ksh

echo  "enter the full name of the  first file:"
read f1
echo  "enter the full name of the  second file:"
read f2

for i in `find $f1 -prune -type f| xargs`
do
for j in `find $f2 -prune -type f | xargs `
do
A=`basename $i`
B=`basename $j`
if [ "$A" -eq "$B" ]
then
(comm $i $j|awk '{print $1,$2}'|uniq) > out.txt
#(cmp $i $j | awk '{print $1, $2}' | uniq ) >log.txt
fi
mv out.txt dodo.txt
done
done

i even tried using it with cmp but cudnt go anywhere.. i am getting the below error.

Code:
./do_it.ksh[14]: CAM.cfg: bad number
mv: out.txt: cannot access: No such file or directory

i am also pasting both the files i am using ..

Code:
file1  - CAM.cfg
[DS] - DOSE
vmsa3=DS101_DS|OMER101|3
vmsa3=DSA101_DS|OMER201|9
vmsa3=DSA102_DS|OMER301|12
vmsa3=DSA102_DS|OMER401|11

[DS2] - DOSE
vmsa4=DSA2_DS|OMER01|2
vmsa4=DSA2_DS|OMER02|3

[DSA300] - DOSE
vmsa4=DSA300_DS|OMER01|3
vmsa4=DSA300_DS|OMER02|4
vmsa4=DSA300_DS|OMER03|5
vmsa4=DSA300_DS|OMER05|7

[VAL0] - VALID
vmsa4=VAL0_DS|OMER01|3
m3vmsa4=VAL00_DS|OMER02|4
m3vmsa4=VAL00_DS|OMER04|6

[INT00] - INT
pps02=INT01_DS|OMER101|3
pps02=INT01_DS|OMER401|9
pps02=INT01_DS|OMER501|11

[VT1] - MAP
vmsa2=VT10_DS|OMER102|4
vmsa2=VT11_DS|OMER202|6
vmsa2=VT12_DS|OMER302|8
vmsa2=VT12_DS|OMER402|9
vmsa2=VT13_DS|OMER501|11
vmsa2=VT14_DS|OMER601|12

attaching my 2nd file ........

the 2nd file is RAM1
Code:
vmsa4=VAL0_DS|LOG_DB|1
vmsa4=VAL0_DS|MIN_DB|2
vmsa4=VAL0_DS|OMER01|3
vmsa4=VAL0_DS|OMER02|4
vmsa4=VAL0_DS|OMER03|5
vmsa4=VAL0_DS|OMER04|6
vmsa4=VAL0_DS|OMER90|90
vmsa3=DSA10_DS|LOG|1
vmsa3=DSA10_DS|MIN_DB|2
vmsa3=DSA10_DS|OMER101|3
vmsa3=DSA10_DS|OMER201|9
vmsa3=DSA10_DS|OMER301|12
vmsa3=DSA1_DS|OMER401|11
vmsa3=DSA10_DS|OMER4401|90
vmsa4=DSA2_DS|LOG|1
vmsa4=DSA2_DS|OMER01|2
vmsa4=DSA2_DS|OMER01|3
vmsa4=DSA30_DS|LOG_DB|1
vmsa4=DSA30_DS|MIN_DB|2
vmsa4=DSA30_DS|OMER01|3
vmsa4=DSA30_DS|OMER02|4
vmsa4=DSA30_DS|OMER03|5
vmsa4=DSA30_DS|OMER04|6
vmsa4=DSA30_DS|OMER05|7
vmsa4=DSA30_DS|OMER90|90
pps02=INT0_DS|LOG|1
pps02=INT0_DS|MIN|2

please let me know if there is anything i am missing in execution...
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Extracting lines present in one file but missing in another using Perl

Hey I have an input file containing a list of numbers like: U01120.CDS.1 D25328.CDS.1 X15573.CDS.1 K03515.CDS.1 L44140.CDS.10 U24183.CDS.1 M97347.CDS.1 U05259.CDS.1 And another input file containing results created on the basis of the above input: G6PT_HUMAN U01120.CDS.1 -1.9450 3.1706... (1 Reply)
Discussion started by: Banni
1 Replies

2. Shell Programming and Scripting

Strings from one file which exactly match to the 1st column of other file and then print lines.

Hi, I have two files. 1st file has 1 column (huge file containing ~19200000 lines) and 2nd file has 2 columns (small file containing ~6000 lines). ################################# huge_file.txt a a ab b ################################## small_file.txt a 1.5 b 2.5 ab ... (4 Replies)
Discussion started by: AshwaniSharma09
4 Replies

3. Shell Programming and Scripting

join based on line number when one file is missing lines

I have a file that contains 87 lines, each with a set of coordinates (x & y). This file looks like: 1 200.3 -0.3 2 201.7 -0.32 ... 87 200.2 -0.314 I have another file which contains data that was taken at certain of these 87 positions. i.e.: 37 125 42 175 86 142 where the first... (1 Reply)
Discussion started by: jackiev
1 Replies

4. UNIX for Dummies Questions & Answers

Compare 2 files print the lines of file 2 that contain a string from file 1

Hello I am a new unix user, and I have a work related task to compare 2 files and print all of the lines in file 2 that contain a string from file 1 Note: the fields are in different columns in the files. I suspect the is a good use for awk? Thanks for your time & help File 1 123 232 W343... (6 Replies)
Discussion started by: KevinRidley
6 Replies

5. Shell Programming and Scripting

File Comparison: Print Lines not present in another file

Hi, I have fileA.txt like this. B01B02 D0011718 B01B03 D0012540 B01B04 D0006145 B01B05 D0004815 B01B06 D0012069 B01B07 D0004064 B01B08 D0011988 B01B09 D0012071 B01B10 D0005596 B01B11 D0011351 B01B12 D0004814 B01C01 D0011804 I want to compare this against another file (fileB.txt)... (3 Replies)
Discussion started by: genehunter
3 Replies

6. UNIX for Dummies Questions & Answers

Adding missing lines in file

Dear all, I have a file with two columns - the first column is increasing every 50, the second column is just count (e.g. 5). However, when count is zero, no line is present. Sample: 1950 7 2000 14 2050 7 2100 13 2150 10 2200 9 2250 7 2300 8 2350 7... (1 Reply)
Discussion started by: TheTransporter
1 Replies

7. UNIX for Dummies Questions & Answers

Adding missing lines in file

Dear all, I have a file with two columns - the first column is increasing every 50, the second column is just count (e.g. 5). However, when count is zero, no line is present. Sample: How can I change the file so as to include lines with zero count? e.g. in the previous file to put... (4 Replies)
Discussion started by: TheTransporter
4 Replies

8. UNIX for Dummies Questions & Answers

Find the missing file and print

Hi , i will be getting 24 files for one day with a formate like 20131028_01 - 20131028_24 kind of ,i am trying to write a shell script to count the number of files and if the count is not equal to 24 print the missing files names for A in `seq 0 23`; do ls *20131024_`printf "%02d" $A`*;... (3 Replies)
Discussion started by: vikatakavi
3 Replies

9. Shell Programming and Scripting

Print Missing Header Name from File.

HI Guys, I have file A.txt ID,L1,L2,L3,L4 1A,2a,33a,44b,55c 2A,10a,14a,15b,16c File B.txt ID L1 L4 L5 Output:- ID,L1,L4,L5 (2 Replies)
Discussion started by: pareshkp
2 Replies

10. Shell Programming and Scripting

Script to search every file in a directory and print last few lines

Hi everyone, I need to write a script to search a directory, output the name of a file to an ouput file and print the last few lines of the files to the output file such that I would have something like this: FILE1: LINE LINE LINE FILE2: LINE LINE LINE FILE3: LINE LINE LINE... (2 Replies)
Discussion started by: mojoman
2 Replies
Locale::Codes::LangFam(3pm)				 Perl Programmers Reference Guide			       Locale::Codes::LangFam(3pm)

NAME
Locale::Codes::LangFam - standard codes for language extension identification SYNOPSIS
use Locale::Codes::LangFam; $lext = code2langfam('apa'); # $lext gets 'Apache languages' $code = langfam2code('Apache languages'); # $code gets 'apa' @codes = all_langfam_codes(); @names = all_langfam_names(); DESCRIPTION
The "Locale::Codes::LangFam" module provides access to standard codes used for identifying language families, such as those as defined in ISO 639-5. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default ISO 639-5 language family codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying language families. A code set may be specified using either a name, or a constant that is automatically exported by this module. For example, the two are equivalent: $lext = code2langfam('apa','alpha'); $lext = code2langfam('apa',LOCALE_LANGFAM_ALPHA); The codesets currently supported are: alpha This is the set of three-letter (lowercase) codes from ISO 639-5 such as 'apa' for Apache languages. This is the default code set. ROUTINES
code2langfam ( CODE [,CODESET] ) langfam2code ( NAME [,CODESET] ) langfam_code2code ( CODE ,CODESET ,CODESET2 ) all_langfam_codes ( [CODESET] ) all_langfam_names ( [CODESET] ) Locale::Codes::LangFam::rename_langfam ( CODE ,NEW_NAME [,CODESET] ) Locale::Codes::LangFam::add_langfam ( CODE ,NAME [,CODESET] ) Locale::Codes::LangFam::delete_langfam ( CODE [,CODESET] ) Locale::Codes::LangFam::add_langfam_alias ( NAME ,NEW_NAME ) Locale::Codes::LangFam::delete_langfam_alias ( NAME ) Locale::Codes::LangFam::rename_langfam_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangFam::add_langfam_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangFam::delete_langfam_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes::API man page. SEE ALSO
Locale::Codes The Locale-Codes distribution. Locale::Codes::API The list of functions supported by this module. http://www.loc.gov/standards/iso639-5/id.php ISO 639-5 . AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 2011-2012 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.16.2 2012-10-11 Locale::Codes::LangFam(3pm)
All times are GMT -4. The time now is 07:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy