Sponsored Content
Top Forums Shell Programming and Scripting Help with replace column one content based on reference file Post 302525606 by perl_beginner on Friday 27th of May 2011 07:52:34 AM
Old 05-27-2011
Help with replace column one content based on reference file

Input file
Code:
1 testing 10 20 1
A testing 20 40 1
3 testing 23 232 2
1 testing 10 243 2
.
.

Reference file
Code:
1 final
3 used
.
.

Output file
Code:
final testing 10 20
A testing 20 40
used testing 23 232
final testing 10 243
.
.

I would like to replace those content that shown in column 1 of input file with the content that shown in reference file (if available).
Thanks.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace character based on reference file problem asking

I got two files right now, input file (target file), reference file 1 (query file) reference file 1 (long list of data) KOLOPWMOPOPO ADASDASD ADSASDASDAD . . target file (one long liner content) ADASDASDTYUKOKOLOPWMOPOPOOPLUAADSASDASDADPOPOUYADADASDASD desired output file content ... (1 Reply)
Discussion started by: patrick87
1 Replies

2. Shell Programming and Scripting

Help with rename header content based on reference file problem

I got long list of reference file >data_tmp_number_22 >data_tmp_number_12 >data_tmp_number_20 . . Input file: >sample_data_1 Math, 5, USA, tmp SDFEWRWERWERWRWER FSFDSFSDFSDGSDGSD >sample_data_2 Math, 15, UK, tmp FDSFSDFF >sample_data_3 Math, 50, USA, tmp ARQERREQR . . Desired... (7 Replies)
Discussion started by: perl_beginner
7 Replies

3. Shell Programming and Scripting

Help with merge two file based on similar column content

Input file 1: A1BG A1BG A1BG A1CF A1CF BCAS BCAS A2LD1 A2M A2M HAT . . Input file 2: A1BG All A1CF TEMP (5 Replies)
Discussion started by: perl_beginner
5 Replies

4. Shell Programming and Scripting

Help with replace column one content based on reference file

Input file 1 testing 10 20 1 A testing 20 40 1 3 testing 23 232 2 1 testing 10 243 2 . . Reference file 1 final 3 used . . Output file (1 Reply)
Discussion started by: perl_beginner
1 Replies

5. Shell Programming and Scripting

multiplication of two files based on the content of the first column

Hi, This is something that probably it is more difficult to explain than to do. I have two files e.g. FILE1 A15 8.3102E+00 3.2000E-04 A15 8.5688E+00 4.3000E-05 B13 5.1100E-01 1.9960E+00 B16 5.1100E-01 2.3000E-03 B16 8.6770E-01 1.0000E-07 B16 9.8693E-01 3.4000E-05... (4 Replies)
Discussion started by: f_o_555
4 Replies

6. Shell Programming and Scripting

Help with analysis data based on particular column content

Input file: Total_counts 1306726155 100% Number_of_count_true 855020282 Number_of_count_true_1 160014283 Number_of_count_true_2 44002825 Number_of_count_true_3 18098424 Number_of_count_true_4 24693745 Number_of_count_false 115421870 Number_of_count_true 51048447 Total_number_of_false ... (2 Replies)
Discussion started by: perl_beginner
2 Replies

7. Shell Programming and Scripting

Print the column content based on the header

i have a input of csv file as below but the sequence of column get changed. I,e it is not necessary that name comes first then age and rest all, it may vary. name,age,marks,roll,section kevin,25,80,456,A Satch,23,56,789,B Meena,24,78,H245,C So i want to print that column entires which... (12 Replies)
Discussion started by: millan
12 Replies

8. Shell Programming and Scripting

Replace a value using a reference data from other file

Gents, Can you please help me to solve this case In my input file I have a values in column 49 which always need to be one, but sometimes the system create a value 2, in this case I need to go to search in the original file and replace the values in the row where the value 2 is and in the... (6 Replies)
Discussion started by: jiam912
6 Replies

9. Shell Programming and Scripting

Replace a word based upon the file content

I have a file which contains timestamp and date in the second column. If the line contains one of the word then it need to be replace like below. Any help is appreciated. File: a smallint b timestamp c date d varchar O/P: a smallint ... (1 Reply)
Discussion started by: JoshvaPeter
1 Replies

10. UNIX for Beginners Questions & Answers

Replace a column in tab delimited file with column in other tab delimited file,based on match

Hello Everyone.. I want to replace the retail col from FileI with cstp1 col from FileP if the strpno matches in both files FileP.txt ... (2 Replies)
Discussion started by: YogeshG
2 Replies
Dist::Metadata::Struct(3pm)				User Contributed Perl Documentation			       Dist::Metadata::Struct(3pm)

NAME
Dist::Metadata::Struct - Enable Dist::Metadata for a data structure VERSION
version 0.923 SYNOPSIS
my $dm = Dist::Metadata->new(struct => { files => { 'lib/Mod.pm' => 'package Mod; sub something { ... }', 'README' => 'this is a fake dist, useful for testing', } }); DESCRIPTION
This is a subclass of Dist::Metadata::Dist to enable mocking up a dist from perl data structures. This is mostly used for testing but might be useful if you already have an in-memory representation of a dist that you'd like to examine. It's probably not very useful on it's own though, and should be used from "new" in Dist::Metadata. METHODS
new $dist = Dist::Metadata::Struct->new(files => { 'lib/Mod.pm' => 'package Mod; sub something { ... }', }); Accepts a "files" parameter that should be a hash of "{ name => content, }". Content can be a string, a reference to a string, or an IO object. default_file_spec "Unix" is the default for consistency/simplicity but "file_spec" can be overridden in the constructor. file_content Returns the string content for the specified name. find_files Returns the keys of the "files" hash. AUTHOR
Randy Stauner <rwstauner@cpan.org> COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Randy Stauner. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-06-19 Dist::Metadata::Struct(3pm)
All times are GMT -4. The time now is 10:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy