I am sorry for not stating my requirement properly , We are trying to accomplish incremental load of data by comparing two files
File 1
File 2
I would like output by comparing above two files which should display below results
Desired Output:
-------------------
Here we are trying to compare two files and if we don't find a record in file 2 based on column 1 ( primary key ) we treat that entry as deleted and we generate a new file with its operational code(in this case deleted). Similarly we if we find record in both the files ( file 1 and file2) we would still have that record in file 3 ,and for modified if we see any column modifies in file 2 we add the entry as modified .
Last edited by Don Cragun; 01-21-2015 at 04:02 PM..
Reason: Add CODE tags.
Hi i hope some awk gurus here can help me.. here is what i need i have 2 files:
File1
152445 516532 405088.pdf
152445 516533 405089.pdf
152491 516668 405153.jpg
152491 520977 408779.jpg
152491 0 409265.pdf
File2
516532 /tmp/MainStreet_Sum09_Front_FNL.pdf
516533... (9 Replies)
Hi. I'm new to awk and have searched for a solution to my problem, but haven't found the right answer yet. I have two files that look like this:
file1
Delete,3105551234
Delete,3105551236
Delete,5625559876
Delete,5625556789
Delete,5625553456
Delete,5625551234
Delete,5625556956... (8 Replies)
Hi,
I want to compare two files using awk and write an output based on if the records matched.
Both the files are space delimitted.
File A:
8351 00000000000636 2009044 -00001.000
8351 00000000000637 2009044 -00002.000
8351 00000000000638 2009044 -00001.000
8351 00000000000640... (7 Replies)
Hi
How can I use awk to compare specific columns in 2 files and print the difference.
I currently have this:
BEGIN {
OFS = FS = ","
}
NR == FNR {
b = $3
next
}
{
e = ""
for (x in b) {
if (match ($1, x)) {
if (RSTART == 1 && RLENGTH > length(e)) {
e=x (2 Replies)
Hello,
I have a script which extracts the values from a csv file when a specific date is entered :
#!/bin/sh
awk 'BEGIN{printf("Entrez la date : "); getline date < "-"}
$0 ~ date {f=1;print;next}
/^{2}\//{f=0}
f' file1.csv
This script gives me a number of lines with different values.
... (6 Replies)
Hi,
I have a situation to compare one file, say file1.txt with a set of files in directory.The directory contains more than 100 files.
To be more precise, the requirement is to compare the first field of file1.txt with the first field in all the files in the directory.The files in the... (10 Replies)
Please help me to compare two files and remove the items in file2 from file1
file 1:delimited using pipe(|)
file1
00012|Description - 1|||||AA12345|1|AB12345|2|2012/06/03
AB123|Description - 2|||||AA12345|3|ZA11111|4|2012/06/04
11111|Description - 3|||||AP00012|1|AB12345|2|2012/06/03... (8 Replies)
HI!!
I am trying to compare two files using AWK but I have some problems. I need to count how many times letters are used in two texts. This is my script
{
long=length($0)
for (i=1;i<=long;i++)
{
aux=substr($0,i,1)
if ( aux != " " && aux != "" )
... (7 Replies)
Discussion started by: ettore8888
7 Replies
LEARN ABOUT REDHAT
igawk
IGAWK(1) Utility Commands IGAWK(1)NAME
igawk - gawk with include files
SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ...
igawk [ all gawk options ] [ -- ] program-text file ...
DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1).
AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like
@include getopt.awk
in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path.
OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports.
EXAMPLES
cat << EOF > test.awk
@include getopt.awk
BEGIN {
while (getopt(ARGC, ARGV, "am:q") != -1)
...
}
EOF
igawk -f test.awk
SEE ALSO gawk(1)
Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995.
AUTHOR
Arnold Robbins (arnold@skeeve.com).
Free Software Foundation Nov 3 1999 IGAWK(1)