Sponsored Content
Top Forums Shell Programming and Scripting I want to find the difference between two files, only for the header (column names) Post 302917492 by Merlin Joseph on Wednesday 17th of September 2014 05:17:39 AM
Old 09-17-2014
@Rudic,

I have even tested your script. It works well for the first time and then when it is executed for the second time it is removing the values from most of the columns. It is even creating a "mismatch.txt" even when there are no columns added in the "feed.txt"

I found these values in the mismatch.txt when I did not add any new columns and values (for testing) in the feed.txt (input file).

Column 2: image
Column 3: id
Column 4: showcase_id
Column 5: showcase_name
Column 6: showcase_zip_code
Column 7: vehicle_id
Column 8: carmodel_id
Column 9: make_id
Column 10: external_mpn
Column 11: carmodel_name
Column 12: make_name
Column 13: colour
Column 14: colour_alias
Column 15: colour_secondary_name
Column 16: colour_secondary_alias
Column 17: trim
Column 18: catalog_price
Column 19: customer_bonus
Column 20: reprise_bonus
Column 21: legal_notice
Column 22: rebate_legal_notice
Column 23: eco_bonus
Column 24: price
Column 25: customer_benefit_percent
Column 26: options
Column 27: code
Column 28: name
Column 29: matriculation_on
Column 30: status
Column 31: updated_at
Column 32: created_at
Column 33: mileage
Column 34: vehicle_acceleration_0_100kph
Column 35: vehicle_air_conditioning
Column 36: vehicle_body_type
Column 37: vehicle_co2_emission_level
Column 38: vehicle_combined_fuel_economy
Column 39: vehicle_cylinders_count
Column 40: vehicle_doors_count
Column 41: vehicle_driven_wheels
Column 42: vehicle_emission_standard
Column 43: vehicle_engine_capacity
Column 44: vehicle_extra_urban_fuel_economy
Column 45: vehicle_fiscal_horse_power
Column 46: vehicle_height
Column 47: vehicle_kerbweight
Column 48: vehicle_length
Column 49: vehicle_max_load_capacity
Column 50: vehicle_name
Column 51: vehicle_primary_fuel_tank_capacity
Column 52: vehicle_primary_fuel_type
Column 53: vehicle_published_hp_metric
Column 54: vehicle_seats_count
Column 55: vehicle_secondary_fuel_type
Column 56: vehicle_type
Column 57: vehicle_luggage_capacity
Column 58: vehicle_tvs_tax
Column 59: vehicle_transmission_shiftable
Column 60: vehicle_trim_name
Column 61: vehicle_trim_code
Column 62: vehicle_urban_fuel_economy
Column 63: vehicle_vehicle_warranty_kms
Column 64: vehicle_vehicle_warranty_months
Column 65: vehicle_width_excluding_mirrors
Column 66: vehicle_transmission_type
Column 67: vehicle_engine_name
Column 68: vehicle_engine_code
Column 69: vehicle_rsi_id
Column 70: image_1
Column 71: image_2
Column 72: image_3
Column 73: image_4
Column 74: image_5

It is skipping the first column name "url"
and also in the output it is removing the column values when executed more than once.

Ex: offre-vehicule-neuf/make/rav4-124-d-4d-2wd-life_157127/chartres_1766?_krg=link&_krk=xyz&_krt=HREV30D003458;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;


Only the delimiters remain.

Thanks

Merlin Joseph
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Column names in flat files

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)
Discussion started by: srivsn
1 Replies

2. Shell Programming and Scripting

script to compare first column of two files and find difference

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)
Discussion started by: adityam
3 Replies

3. Shell Programming and Scripting

find difference in file column...

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)
Discussion started by: malcomex999
1 Replies

4. Shell Programming and Scripting

Rename a header column by adding another column entry to the header column name URGENT!!

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)
Discussion started by: Vavad
4 Replies

5. UNIX for Dummies Questions & Answers

Rename a header column by adding another column entry to the header column name

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)
Discussion started by: Vavad
1 Replies

6. UNIX for Dummies Questions & Answers

Find the average based on similar names in the first column

I have a table, say this: name1 num1 num2 num3 num4 name2 num5 num6 num7 num8 name3 num1 num3 num4 num9 name2 num8 num9 num1 num2 name2 num4 num5 num6 num4 name4 num4 num5 num7 num8 name5 num1 num3 num9 num7 name5 num6 num8 num3 num4 I want a code that will sort my data according... (4 Replies)
Discussion started by: FelipeAd
4 Replies

7. Shell Programming and Scripting

Script to find difference between 2 files by column

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)
Discussion started by: shakthi666
1 Replies

8. Homework & Coursework Questions

Script to find difference between 2 files by column

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)
Discussion started by: shakthi666
1 Replies

9. Shell Programming and Scripting

How to get difference of the same column between two files when other column matches?

File 1: 20130416,235800,10.78.25.104,BR2-loc,60.0,1624,50.0,0,50.0,0 20130416,235800,10.78.25.104,BR1-LOC,70.0,10,50.0,0,70.0,0 20130416,235800,10.78.25.104,Hub_None,60.0,15,60.0,0,50.0,0 File 2: 20130417,000200,10.78.25.104,BR2-loc,60.0,1626,50.0,0,50.0,0... (3 Replies)
Discussion started by: Lakshmikumari
3 Replies

10. Shell Programming and Scripting

Prefix a variable in the first column of all the records of the files with and without header

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
Class::DBI::ColumnGrouper(3pm)				User Contributed Perl Documentation			    Class::DBI::ColumnGrouper(3pm)

NAME
Class::DBI::ColumnGrouper - Columns and Column Groups SYNOPSIS
my $colg = Class::DBI::ColumnGrouper->new; $colg->add_group(People => qw/star director producer/); my @cols = $colg->group_cols($group); my @all = $colg->all_columns; my @pri_col = $colg->primary; my @essential_cols = $colg->essential; DESCRIPTION
Each Class::DBI class maintains a list of its columns as class data. This provides an interface to that. You probably don't want to be dealing with this directly. METHODS
new my $colg = Class::DBI::ColumnGrouper->new; A new blank ColumnnGrouper object. clone my $colg2 = $colg->clone; Clone an existing ColumnGrouper. add_column / find_column $colg->add_column($name); my Class::DBI::Column $col = $colg->find_column($name); Add or return a Column object for the given column name. add_group $colg->add_group(People => qw/star director producer/); This adds a list of columns as a column group. group_cols / groups_for my @colg = $cols->group_cols($group); my @groups = $cols->groups_for(@cols); This returns a list of all columns which are in the given group, or the groups a given column is in. columns_in my @cols = $colg->columns_in(@groups); This returns a list of all columns which are in the given groups. all_columns my @all = $colg->all_columns; This returns a list of all the real columns. primary my $pri_col = $colg->primary; This returns a list of the columns in the Primary group. essential my @essential_cols = $colg->essential; This returns a list of the columns in the Essential group. perl v5.12.4 2005-09-14 Class::DBI::ColumnGrouper(3pm)
All times are GMT -4. The time now is 09:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy