I want to find the difference between two files, only for the header (column names)
Hi All,
I want to find the difference between two files, by checking only the headers (column names) and report if any new column is added in the latest file.
For Ex: If the file "declartion.txt has these columns
and the actual file "feed.txt" has a newly added column either in the middle or in the last like
The declaration file which will have only the header (column names), but the "feed.txt" will have column names and the values for those columns under each column. Comparison is required only for the column names (header) and not any values.
After the comparison the shell script should should report the newly added column For Ex: "colour" in a file called "report_column_mis-match.txt". Once the report file is created I the shell script should further remove the new column which is added by the data provider along with it's values.
The data provider is adding columns each now and then not informing us in advance which is creating the problem while loading the file in to mysql database. since the values get loaded haywire when the new column added in the data file but the same is not added in the mysql table.
I finding this bit complicated since I am not a shell script expert. Please help.
Thanks in advance.
Regards
Praveen
Moderator's Comments:
Please use CODE tags as in the Forum Rules for code, files, input & output/errors
They make it clearer to read and preserves multiple spaces and other critical information about the content
Last edited by rbatte1; 09-10-2014 at 08:42 AM..
Reason: Added CODE tags. Infraction already issued.
Hi all,
I want to create column names in a flat file and then load the data through some other application. For example, I have a file with emp.txt and I need column names as eno,ename,sal in the first line. The delimiter here is comma and record delimiter is end of line or unix new line. Could... (1 Reply)
Hi,
I want to write a script which will compare the 1st column of both the files and will give the difference.
e.g:-
my 1st file contains:
89 /usr
52 /usr/local
36 /tmp
92 /opt
96 /home
27 /etc/opt/EMCom
1 ... (3 Replies)
Hi All,
i have a file that is tab delimited. i need help to find the rows which are having same price based on the site code but some times, there are difference so i need to find only the records which are different in all site code.
Dept Sec Barcode 10001 10002 10003 10004... (1 Reply)
Hi All,
I have a file example.csv which looks like this
GrpID,TargetID,Signal,Avg_Num
CSCH74_1_1,2007,61,256
CSCH74_1_1,212007,647,679
CSCH74_1_1,12007,3,32
CSCH74_1_1,207,299,777
I want the output as
GrpID,TragetID,Signal-CSCH74_1_1,Avg_Num
CSCH74_1_1,2007,61,256... (4 Replies)
Hi All,
I have a file example.csv which looks like this
GrpID,TargetID,Signal,Avg_Num
CSCH74_1_1,2007,61,256
CSCH74_1_1,212007,647,679
CSCH74_1_1,12007,3,32
CSCH74_1_1,207,299,777
I want the output as
GrpID,TragetID,Signal-CSCH74_1_1,Avg_Num
CSCH74_1_1,2007,61,256... (1 Reply)
Hi , i am newbie to shell scripting and am trying to do the below job,
A shell script to be run with a command like
sh Compare.ksh file1.txt file2.txt 1 2 > file3.txt
1 2-are the key columns
Consider the delimiter would be Tab or comma
File 1:
SK TEST NAME MATHS PHYSICS
21 1... (1 Reply)
Hi , i am newbie to shell scripting and am trying to do the below job,
A shell script to be run with a command like
sh Compare.ksh file1.txt file2.txt 1 2 > file3.txt
1 2-are the key columns
Consider the delimiter would be Tab or comma
File 1:
SK TEST NAME MATHS PHYSICS
21 1 AAA... (1 Reply)
In a bash shell, I have to prefix a variable to two .CSV files File1.CSV and File2.CSV. One of the files has a header and the other one is with no header in the below format:
"value11","value12","value13","value14","value15","value16"
"value21","value22","value23","value24","value25","value26"... (7 Replies)
Discussion started by: dhruuv369
7 Replies
LEARN ABOUT DEBIAN
ppix::editortools::findvariabledeclaration
PPIx::EditorTools::FindVariableDeclaration(3pm) User Contributed Perl Documentation PPIx::EditorTools::FindVariableDeclaration(3pm)NAME
PPIx::EditorTools::FindVariableDeclaration - inds where a variable was declared using PPI
SYNOPSIS
# finds declaration of variable at cursor
my $declaration = PPIx::EditorTools::FindVariableDeclaration->new->find(
code =>
"package TestPackage;
use strict;
BEGIN {
$^W = 1;
}
my $x=1;
$x++;"
line => 5,
column => 2,
);
my $location = $declaration->element->location;
DESCRIPTION
Finds the location of a variable declaration.
METHODS
new()
Constructor. Generally shouldn't be called with any arguments.
find( ppi => PPI::Document $ppi, line => $line, column => $column ) =item find( code => Str $code, line => $line, column => $column )
Accepts either a "PPI::Document" to process or a string containing the code (which will be converted into a "PPI::Document") to
process. Searches for the variable declaration and returns a "PPIx::EditorTools::ReturnObject" with the declaration
("PPI::Statement::Variable") available via the "element" accessor.
Croaks with a "no token" exception if no token is found at the location. Croaks with a "no declaration" exception if unable to find
the declaration.
SEE ALSO
This class inherits from "PPIx::EditorTools". Also see App::EditorTools, Padre, and PPI.
perl v5.14.2 2012-03-11 PPIx::EditorTools::FindVariableDeclaration(3pm)