Sponsored Content
Top Forums Shell Programming and Scripting Merging of files with different headers to make combined headers file Post 302341619 by marut_ashu on Thursday 6th of August 2009 09:36:18 AM
Old 08-06-2009
Lightbulb Merging of files with different headers to make combined headers file

Hi ,
I have a typical situation. I have 4 files and with different headers (number of headers is varible ).
I need to make such a merged file which will have headers combined from all files (comman coluns should appear once only).

For example -
File 1
H1|H2|H3|H4
11|12|13|14
21|22|23|23

File 2

H3|H5|H6
31|32|33
41|42|43

Merged file of these two will be -

H1|H2|H3|H4|H5|H6
11|12|13|14|NA||NA
21|22|23|23|NA|NA
NA|NA|31|NA|32|33
NA|NA|41|NA|42|43

Please help me for the same.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

help:how to remove headers in output file

Hi I am running a script (which compares two directory contents) for which I am getting an output of 70 pages in which few pages are blank so I was able to delete those blank lines. But I also want to delete the headers present for each page. can any one help me by providing the code... (1 Reply)
Discussion started by: raj_thota
1 Replies

2. Shell Programming and Scripting

Remove text between headers while leaving headers intact

Hi, I'm trying to strip all lines between two headers in a file: ### BEGIN ### Text to remove, contains all kinds of characters ... Antispyware-Downloadserver.com (Germany)=http://www.antispyware-downloadserver.c om/updates/ Antispyware-Downloadserver.com #2... (3 Replies)
Discussion started by: Trones
3 Replies

3. UNIX for Dummies Questions & Answers

reading file headers

Hello, I have done much googling on this, but apparently not using the right keywords. I am assuming there is some kind of header for each file on a disk which stores information such as mod time, access time, etc. I have two questions: 1) is there a way to read this header directly,... (2 Replies)
Discussion started by: Allasso
2 Replies

4. Shell Programming and Scripting

Multiple headers in a file

Hi , I have a .txt file in which I have multiple headers, the header record starts with $ symbol...like the first column name is $Account. I have to keep the header in the first line and delete all the remaining headers which are in the file. I tried using sort adc.txt | uniq -u , but my... (7 Replies)
Discussion started by: gaur.deepti
7 Replies

5. Shell Programming and Scripting

Editing File Headers

Hey Guys, Absolute neewbie here. I am trying to see if it is possible to edit headers/meta-data of files in Mac OSX. I am basically trying to change an audio file header to read 16bit instead of 24bit. We have an issue with some of our software and it regularly exports 16bit audio files with... (3 Replies)
Discussion started by: andysuperaudiom
3 Replies

6. Shell Programming and Scripting

Faster command to remove headers for files in a directory

Good evening Im new at unix shell scripting and im planning to script a shell that removes headers for about 120 files in a directory and each file contains about 200000 lines in average. i know i will loop files to process each one and ive found in this great forum different solutions... (5 Replies)
Discussion started by: alexcol
5 Replies

7. Shell Programming and Scripting

Merging File with headers

Hi I need to merge 4 files. The issue i am facing is all the files have headers and i do not want them in the final output file. Can anybody suggest how to do it? (5 Replies)
Discussion started by: Arun Mishra
5 Replies

8. Shell Programming and Scripting

Joining two files by retaining the headers.

Hi Experts, I want to join two files(file1 ,file2) which are having tab separated values,by sorting them on key column(ID) and want to redirect the output to other file(output file) along with the headers from both the files. cat file1: ID Name phone_no 205 mno 90808 200 xyz 32003... (9 Replies)
Discussion started by: bharathbangalor
9 Replies

9. Shell Programming and Scripting

Row bind multiple csv files having different column headers

All, I guess by this time someone asked this kind of question, but sorry I am unable to find after a deep search. Here is my request I have many files out of which 2 sample files provided below. File-1 (with A,B as column headers) A,B 1,2 File-2 (with C, D as column headers) C,D 4,5 I... (7 Replies)
Discussion started by: ks_reddy
7 Replies

10. Shell Programming and Scripting

awk to compare files and validate order of headers

The below awk verifies the count and order of each text file in the directory. The script does execute and produce output, however the order of the headers are not compared to key. The portion in bold is supposed to do that. If the order of the headers in each text file is the same as key, then... (0 Replies)
Discussion started by: cmccabe
0 Replies
Courriel::Headers(3pm)					User Contributed Perl Documentation				    Courriel::Headers(3pm)

NAME
Courriel::Headers - The headers for an email part VERSION
version 0.29 SYNOPSIS
my $email = Courriel->parse( text => ... ); my $headers = $email->headers; print "$_ " for $headers->get('Received'); DESCRIPTION
This class represents the headers of an email. Any sub part of an email can have its own headers, so every part has an associated object representing its headers. This class makes no distinction between top-level headers and headers for a sub part. Each individual header name/value pair is represented internally by a Courriel::Header object. Some headers have their own special subclass. These are: o Content-Type This is stored as a Courriel::Header::ContentType object. o Content-Disposition This is stored as a Courriel::Header::Disposition object. API
This class supports the following methods: Courriel::Headers->parse( ... ) This method creates a new object by parsing a string. It accepts the following parameters: o text The text to parse. This can either be a plain scalar or a reference to a scalar. If you pass a reference, the underlying scalar may be modified. o line_sep The line separator. This default to a " ", but you can change it if necessary. Note that this only affects parsing, header objects are always output with RFC-compliant line endings. Header parsing unfolds folded headers, and decodes any MIME-encoded values as described in RFC 2047. Parsing also decodes header attributes encoded as described in RFC 2231. Courriel::Headers->new( headers => [ ... ] ) This method creates a new object. It accepts one parameter, "headers", which should be an array reference of header names and values. A given header key can appear multiple times. This object does not (yet, perhaps) enforce RFC restrictions on repetition of certain headers. Header order is preserved, per RFC 5322. $headers->get($name) Given a header name, this returns a list of the Courriel::Header objects found for the header. Each occurrence of the header is returned as a separate object. $headers->get_values($name) Given a header name, this returns a list of the string values found for the header. Each occurrence of the header is returned as a separate string. $headers->add( $name => $value ) Given a header name and value, this adds the headers to the object. If any of the headers already have values in the object, then new values are added after the existing values, rather than at the end of headers. The value can be provided as a string or a Courriel::Header object. $headers->unshift( $name => $value ) This is like "add()", but this pushes the headers onto the front of the internal headers array. This is useful if you are adding "Received" headers, which per RFC 5322, should always be added at the top of the headers. The value can be provided as a string or a Courriel::Header object. $headers->remove($name) Given a header name, this removes all instances of that header from the object. $headers->replace( $name => $value ) A shortcut for calling "remove()" and "add()". The value can be provided as a string or a Courriel::Header object. $headers->as_string( skip => ...., charset => ... ) This returns a string representing the headers in the object. The values will be folded and/or MIME-encoded as needed. The "skip" parameter should be an array reference containing the name of headers that should be skipped. This parameter is optional, and the default is to include all headers. The "charset" parameter specifies what character set to use for MIME-encoding non-ASCII values. This defaults to "utf8". The charset name must be one recognized by the Encode module. MIME encoding is always done using the "B" (Base64) encoding, never the "Q" encoding. $headers->stream_to( output => $output, skip => ...., charset => ... ) This method will send the stringified headers to the specified output. See the "as_string()" method for documentation on the "skip" and "charset" parameters. ROLES
This class does the "Courriel::Role::Streams" role. AUTHOR
Dave Rolsky <autarch@urth.org> COPYRIGHT AND LICENSE
This software is Copyright (c) 2012 by Dave Rolsky. This is free software, licensed under: The Artistic License 2.0 (GPL Compatible) perl v5.14.2 2012-03-07 Courriel::Headers(3pm)
All times are GMT -4. The time now is 03:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy