Welcome to forum, kindly use the code tags while using commands and codes in the posts please as per forum rules. Kindly go through the forum rules in following link. https://www.unix.com/misc.php?do=cfrules
Following may help you in same.
Code:
awk -vs1="\"" 'FNR==NR{A=$NF;$NF="";X[$0]=A;Q=FILENAME;next} {B=$NF;$NF=""} ($0 in X){if(B - X[$0] > 1){print FILENAME " column " s1 $0 B s1 " last column has grater value than last colum in " Q " for column " s1 $0 s1}}' File1 File2
Output will be as follows as per given input by you.
Code:
File2 column "Mar Account3 2014 1239" last column has grater value than last colum in File1 for column "Mar Account3 2014 "
EDIT: Just added a bit of code to get the complete columns which have differance more than 1 as follows.
Code:
awk -vs1="\"" 'FNR==NR{A=$NF;$NF="";X[$0]=A;Y[$0]=A;Q=FILENAME;next} {B=$NF;$NF=""} ($0 in X){if(B - X[$0] > 1){print FILENAME " column " s1 $0 B s1 " last column has grater value than last colum in " Q " for column " s1 $0 Y[$0] s1}}' File1 File2
Output will be as follows.
Code:
File2 column "Mar Account3 2014 1239" last column has grater value than last colum in File1 for column "Mar Account3 2014 1233"
Thanks,
R. Singh
Last edited by RavinderSingh13; 12-01-2014 at 02:48 AM..
Reason: Added one more solution a little chang to previous solution
i want to take position 19-24(only first line) from all files and need to compare any duplication is there or not.
If duplication, then i have to print the file names.
I have written to take the characters from 19-24 from all files. but how to compare ?
... (1 Reply)
Hi,
I need to compare a column in two different csv files
file1
xyz.com,2/2/12,a,b,c
eg.com,2/2/23,a,b,ga
file2
1,2,ua,xyz.com
1,2,ua,abc.com
1,2,ua,eg.com
1,2,ua,easg.com
1,2,ua,zth.com
Read all entries in file1(which has 1000+) and compare column1 of file1 with the column4... (13 Replies)
Hi Experts,
My requirement is to compare the second field/column in two files, if the second column is same in both the files then compare the first field. If the first is not matching then print the first and second fields of both the files.
first file (a .txt)
< 1210018971FF0000,... (6 Replies)
Hello friends,
How can I use awk commands to obtain selective blocks from different data files. For example
file1
a b c
d e f
g h i
file2
1 2 3
4 5 6
7 8 9
output
a b 2 3
d e 5 6
g h 8 9
is it possible ? (2 Replies)
Dear all,
I am having two files big files i need an output file as first occurance of file1 field in file2
example:
file1:raju
ranifile2:raju|123
raju|879
rani|623
rani|253result:raju|123
rani|623pls help me in this regard (3 Replies)
Hi guys, I need your help.
I have two files:
file1
1
3
5
file2
1,XX
2,AA
3,BB
4,CC
5,DD
I would like to compare the first column and where they are equal to write that output in a new file:
1,XX
3,BB (7 Replies)
Hi , I want to compare first 3 columns of File A and File B and create a new file File C which will have all rows from File B and will include rows that are present in File A and not in File B based on First 3 column comparison.
Thanks in advance for your help.
File A
A,B,C,45,46... (2 Replies)
I have a series of csv files in the following format
eg file1
Experiment Name,XYZ_07/28/15,
Specimen Name,Specimen_001,
Tube Name, Control,
Record Date,7/28/2015 14:50,
$OP,XYZYZ,
GUID,abc,
Population,#Events,%Parent
All Events,10500,
P1,10071,95.9
Early Apoptosis,1113,11.1
Late... (6 Replies)
Hello world!
I need to gather all the data from different folders and copy it in an one unique text file in columns format.
Let me explain, letīs say "a, b, c" are 3 data files of thousands and thousands lines (in the reality, I have nearly one hundred).
"a, b, c" are located in the folders... (5 Replies)
Discussion started by: user10600
5 Replies
LEARN ABOUT NETBSD
wcwidth
WCWIDTH(3) BSD Library Functions Manual WCWIDTH(3)NAME
wcwidth -- number of column positions of a wide-character code
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <wchar.h>
int
wcwidth(wchar_t wc);
DESCRIPTION
The wcwidth() function determines the number of column positions required to display the wide character wc.
RETURN VALUES
The wcwidth() function returns 0 if the wc argument is a nul wide character (L'