Sponsored Content
Full Discussion: Joining 2 CSV files together
Top Forums UNIX for Advanced & Expert Users Joining 2 CSV files together Post 302192147 by penchal_boddu on Tuesday 6th of May 2008 06:30:00 AM
Old 05-06-2008
Hi,

You can add this line as 2nd line of the above script for complete output

echo "HEADER \nHEADER \nheader \n, ,HEADER " >> final_out

Output:
HEADER
HEADER
header
, ,HEADER
001X ,,300
002X ,,300
003X ,,500
004X ,,300
005X ,,600
006X ,,100
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

joining 2 files

Hi, I have two files that I need to find difference between. Do I use diff or join? If join, how do I use it? thanks, webtekie (1 Reply)
Discussion started by: webtekie
1 Replies

2. UNIX for Dummies Questions & Answers

joining files

Hi, Could anyone help me ? I'm trying to join two files, but no common field are on them. So I think on generate \000\ sequence to add for each line on both files, so then will be able to join these files. Any idea? Thanks in advance, (2 Replies)
Discussion started by: Manu
2 Replies

3. Shell Programming and Scripting

Help with joining two files

Greetings, all. I've got a project that requires I join two data files together, then do some processing and output. Everything must be done in a shell script, using standard unix tools. The files look like the following: File_1 Layout: Acct#,Subacct#,Descrip Sample: ... (3 Replies)
Discussion started by: rjlohman
3 Replies

4. Shell Programming and Scripting

Joining Three Files

Hi guys, I have three files which needs to be joined to a single file. File 1: Col a, Col b, Col c File 2: Col 1a, Col 1b File 3: Col 2a, Col 2b Output: Col 1a, Col 2a, Col a, Col b, Col c. All the files are comma delimited. I need to join Col b with Col 1b and need to... (17 Replies)
Discussion started by: mac4rfree
17 Replies

5. UNIX for Dummies Questions & Answers

Joining two files

I have two comma separated files. I want to join those filesa nd put the result in separate file. smaple data are: file1: A1,1,100 A2,1,200 B1,2,100 B2,2,200 file2 1,50 1,25 1,25 1,100 1,100 2,50 2,50 (10 Replies)
Discussion started by: pandeesh
10 Replies

6. Shell Programming and Scripting

Joining two files into one

Hi experts, I'm quite newbie here!! I have two seperate files. Contents of file like below File 1: 6213019212001 8063737 File:2 15703784 I want to join these two files into one where content will be File 3: 6213019212001 8063737 15703784 Regards, Ray Seilden (1 Reply)
Discussion started by: RayanS
1 Replies

7. Shell Programming and Scripting

Help with joining files and adding headers to files

Hi, I have about 20 tab delimited text files that have non sequential numbering such as: UCD2.summary.txt UCD45.summary.txt UCD56.summery.txt The first column of each file has the same number of lines and content. The next 2 column have data points: i.e UCD2.summary.txt: a 8.9 ... (8 Replies)
Discussion started by: rrdavis
8 Replies

8. Shell Programming and Scripting

Joining 2 Files

File "A" (column names: Nickname Number GB) Nickname Number GB PROD_DB0034 100A 16 ASMIL1B_DATA_003 100B 16 PSPROD_0000 1014 36 PSPROD_0001 100D 223 ..... File "B" (column names: TYPE DEVICE NUMBER SIZE) TYPE DEVICE NUMBER SIZE 1750500 hdisk2 100A 16384 1750500 hdisk3 ... (4 Replies)
Discussion started by: Daniel Gate
4 Replies

9. Shell Programming and Scripting

Please help me in joining two files

I have two files with the below contents : sampleoutput3.txt 20150202;hostname1 20150223;hostname2 20150716;hostname3 sampleoutput1.txt hostname;packages_out_of_date;errata_out_of_date; hostname1;11;0; hostnamea;12;0; hostnameb;11;0; hostnamec;95;38; hostnamed;440;358;... (2 Replies)
Discussion started by: rahul2662
2 Replies

10. Shell Programming and Scripting

CSV joining and checking multiple files

Hello, For our work we use several scripts to gather/combine data for use in our webshop. Untill now we did not had any problems but since a couple days we noticed some mismatches between imports. It happened that several barcodes where matched even though it was a complete other product. Of... (19 Replies)
Discussion started by: SDohmen
19 Replies
SimpleX(3pm)						User Contributed Perl Documentation					      SimpleX(3pm)

NAME
Net::IMAP::SimpleX - Addons for Net::IMAP::Simple SYNOPSIS
use strict; use warnings; use Net::IMAP::SimpleX; Net::IMAP::SimpleX uses Net::IMAP::Simple as a base so the object creation is the same as it is for the ancestor: my $imap = Net::IMAP::SimpleX->new('imap.example.com') || die "Unable to connect to IMAP: $Net::IMAP::Simple::errstr "; $imap->select("INBOX"); Net::IMAP::SimpleX is a collection of handy methods that are not simple, require Parse::RecDescent, or are experimental. DESCRIPTION
This module adds some useful, yet not so simple, extensions on top of Net::IMAP::Simple. METHODS
new For details on the invocation, read Net::IMAP::Simple. body_summary Typical invocations will take this overall shape. # get an object representation of the message body my $summary = $imap->body_summary($message_number); # multipart message if ($summary->has_parts) { for my $subpart ($summary->parts) { if ($subpart->has_parts) { ... } # examine the message part my @attr = map { $subpart->$_ } qw/content_type encoding encoded_size/; # fetch the raw message part my $subpart_body = $imap->get($message_number, $subpart->part_number); } } else { my $body = $summary->body; my @attr = map { $body->$_ } qw/content_type encoding encoded_size/ } This method returns a simple object that contains a representation of the body of a message. The object is built by a Parse::RecDescent parser using the output of an IMAP fetch body command. The parser uses the formal syntax as defined by RFC3501 http://tools.ietf.org/html/rfc3501#section-9 <http://tools.ietf.org/html/rfc3501#section-9>. my $body = $summary->body; my @attr = map { $body->$_ } qw/ content_description encoded_size charset content_type part_number format id encoding /; For multipart messages, the object contains sub-objects for each message part, accessible via the parts() method and inspected via the has_parts() method. The type method describes the type of multipart (such as mixed or alternative). The parts method returns a list of sub parts, which themselves may have subparts, and so on. An example of a multipart, alternative message with a text body and an html version of the body would looke something like: if ($summary->has_parts) { if ($summary->type eq 'alternative') { my ($html) = grep { $_->content_type eq 'text/html' } $summary->parts; } } A really complex, multipart message could look something like this: if ($summary->has_parts && $summary->type eq 'mixed') { for my $part ($summary->parts) { if ($part->has_parts && $part->type eq 'mixed') { ... } ... } } fetch The fetch command returns the various parts of messages that users request. It is fairly complicated (following RFC3501 using a grammar/parser), but there are some basic patterns that it follows. my $res =$imap->fetch('30:32' => 'UID BODY.PEEK[HEADER.FIELDS (DATE)] FLAGS') # $res = { # 30 => { # "BODY[HEADER.FIELDS (DATE)]" => "Date: Sun, 18 Jul 2010 20:54:48 -0400 ", # "FLAGS" => ["\Flagged", "\Seen"], # "UID" => 58890, # }, # 31 => { # "BODY[HEADER.FIELDS (DATE)]" => "Date: Wed, 21 Jul 2010 09:09:04 -0400 ", # "FLAGS" => ["\Seen"], # "UID" => 58891, # }, # 32 => { # "BODY[HEADER.FIELDS (DATE)]" => "Date: Sat, 24 Jul 2010 05:12:06 -0700 ", # "FLAGS" => ["\Seen"], # "UID" => 58892, # }, # } So-called "parenthized" lists will be returned as an array (see "FLAGS") but nearly everything else will come back as strings. This includes parenthized queries. Take "BODY.PEAK[HEADER.FIELDS (DATE FROM SUBJECT)]"), for example. The result would come back as the RFC822 header lines (as the above "Date: Sun, ..." has done). For more information about the different types of queries, see RFC3501. There's a surprising number of things that can be queried. uidfetch This is roughly the same thing as the "fetch()" method above, but the query runs on UIDs instead of sequence numbers. The keys of the $res are still the sequence numbers though. my $res =$imap->fetch('58890' => 'UID BODY.PEEK[HEADER.FIELDS (DATE)] FLAGS') # $res = { # 30 => { # "BODY[HEADER.FIELDS (DATE)]" => "Date: Sun, 18 Jul 2010 20:54:48 -0400 ", # "FLAGS" => ["\Flagged", "\Seen"], # "UID" => 58890, # }, # ... AUTHOR
INITIAL AUTHOR Jason Woodward "<woodwardj@jaos.org>" ADDITIONAL CONTRIBUTIONS Paul Miller "<jettero@cpan.org>" [fetch()] COPYRIGHT
Copyright (c) 2010 Jason Woodward All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. LICENSE
This module is free software. You can redistribute it and/or modify it under the terms of the Artistic License 2.0. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. BUGS
https://rt.cpan.org/Dist/Display.html?Queue=Net-IMAP-Simple <https://rt.cpan.org/Dist/Display.html?Queue=Net-IMAP-Simple> SEE ALSO
perl, Net::IMAP::Simple, Parse::RecDescent perl v5.14.2 2012-02-11 SimpleX(3pm)
All times are GMT -4. The time now is 09:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy