Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Formatting data in a raw file by using another mapping file Post 302762659 by ravi4informatic on Tuesday 29th of January 2013 12:34:13 AM
Old 01-29-2013
Hi all,

Thanks for the prompt response. Below is the sample data for both files

mapping file:

Header: AU_Template_Field,RawFile_Field

Data:
VENDOR_NAME,VENDOR NAME
SHIP_TO_PARTY_NAME, PARTY_NAME
SHIP_TO_PARTY_ADDRESS1,PARTY_ADDRESS1
SHIP_TO_PARTY_ADDRESS2,PARTY_ADDRESS2
SHIP_TO_PARTY_CITY,PARTY_CITY
SHIP_TO_PARTY_STATE,PARTY_STATE
SHIP_TO_PARTY_ZIP,PARTY_ZIP

Raw File:

Header: VENDOR NAME,PARTY_NAME,PARTY_ADDRESS1,PARTY_ADDRESS2,PARTY_CITY,PARTY_STATE,PARTY_ZIP

data: abc,xyz,aaa,lny,london,london,abc123

output file:

header: VENDOR_NAME,SHIP_TO_PARTY_NAME,SHIP_TO_PARTY_ADDRESS1,SHIP_TO_PARTY_ADDRESS2,SHIP_TO_PARTY_CITY,SHIP _TO_PARTY_STATE,SHIP_TO_PARTY_ZIP

the out file strcture is standard but raw file structure might vary each time that the reason business is providing mapping file to map the columns for target file.

i hope this explanation would be clear to all.

awaiting for the responses.

Thanks in advance

Ravi
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk formatting of a data file - nested for loops?

Hello - is there any way in awk I can do... 4861 x(1) y(1) z(1) 4959 x(1) y(1) z(1) 5007 x(1) y(1) z(1) 4861 x(2) y(2) z(2) 4959 x(2) y(2) z(2) 5007 x(2) y(2) z(2) 4861 x(3) y(3) z(3) 4959 x(3) y(3) z(3) 5007 x(3) y(3) z(3) to become... 4861 x(1) y(1) z(1) 4861 x(2) y(2) z(2)... (3 Replies)
Discussion started by: catwoman
3 Replies

2. Shell Programming and Scripting

formatting data file with awk or sed

Hi, I have a (quite large) data file which looks like: _____________ header part.. more header part.. x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 ... ... x59 x60 y1 y2 y3 y4... ... y100 ______________ where x1, x2,...,x60 and y1, y2,...y100 are numbers of 10 digits (so each line... (5 Replies)
Discussion started by: lego
5 Replies

3. UNIX for Dummies Questions & Answers

How to make a CSV file from a Raw data

Hi Please help me on this.i have the Following data i want to make it CSV file by a Unix Shell Script. •msgType : 234 ( m_code : 0 # m_name : type # m_data : LOG ) pls help me on this (4 Replies)
Discussion started by: Aditya.Gurgaon
4 Replies

4. Shell Programming and Scripting

Formatting Report and Reading data and fetching the details from contents file

Data I was trying to write shell script which will be return the output in the below format First i was trying to do these using sed. sed -n '/.ksh/p' mainksh.ksh sed -e 's/*\(.*\)/\1/g' mainksh.ksh $RUN_DIR, $SUB_DIR and the variables which will be defined in the profile file. when i am... (0 Replies)
Discussion started by: rameshds
0 Replies

5. Shell Programming and Scripting

AWK/Shell script for formatting data in a file

Hi All, Need an urgent help to convert a unix file in to a particular format: **source file:** 1111111 2d2f2h2 3dfgsd3 ........... 1111111 <-- repeats in every nth line. remaining all lines will be different 123ss41 432ff45 ........... 1111111 <-- repetition qwe1234 123weq3... (1 Reply)
Discussion started by: rajivnairfis
1 Replies

6. UNIX for Dummies Questions & Answers

Mapping a data in a file and delete line in source file if data does not exist.

Hi Guys, Please help me with my problem here: I have a source file: 1212 23232 343434 ASAS1 4 3212 23232 343434 ASAS2 4 3234 23232 343434 QWQW1 4 1134 23232 343434 QWQW2 4 3212 23232 343434 QWQW3 4 and a mapping... (4 Replies)
Discussion started by: kokoro
4 Replies

7. Shell Programming and Scripting

Formatting file data to another file (control character related)

I have to write a program to read data from files and then format into another file. However, I face a strange problem related to control character that I can't understand and solve. The source file is compose of many lines with such format: T_NAME|P_NAME|P_CODE|DOCUMENT_PATH|REG_DATE ... (3 Replies)
Discussion started by: hk6279
3 Replies

8. Shell Programming and Scripting

Data formatting in CSV file to EXCEL

Hello friends I want to convert an csv file on unix (which is generated by a ETL application) to a formatted excel sheet like .I have roughly like 28 columns 1)All numbers need to be stored as numbers with leading zeros-like format as text for this column to preserve leading zeroes e.g... (6 Replies)
Discussion started by: etldev
6 Replies

9. Shell Programming and Scripting

Formatting data to put it in the excel file

Hello, I have a file with the below contents : Policy Name: Backup_bkp Policy Type: Catalog_bkp Active: yes Effective date: 08/07/2013 02:02:12 Mult. Data Streams: no Client Encrypt: no Checkpoint: no Policy Priority: ... (11 Replies)
Discussion started by: rahul2662
11 Replies

10. Shell Programming and Scripting

Replacing 12 columns of one file by second file based on mapping in third file

i have a real data prod file with 80+ fields containing 1k -2k records. i have to extract say 12 columns out of this which are sensitive fields along with one primary key say SEQ_ID (like DOB,account no, name, SEQ_ID, govtid etc) in a lookup file. i have to replace these sensitive fields in... (11 Replies)
Discussion started by: megh12
11 Replies
Net::DNS::Header(3pm)					User Contributed Perl Documentation				     Net::DNS::Header(3pm)

NAME
Net::DNS::Header - DNS packet header class SYNOPSIS
"use Net::DNS::Header;" DESCRIPTION
A "Net::DNS::Header" object represents the header portion of a DNS packet. METHODS
new $header = Net::DNS::Header->new; "new" creates a header object appropriate for making a DNS query. parse ($header, $offset) = Net::DNS::Header->parse($data); Parses the header record at the start of a DNS packet. The argument is a reference to the packet data. Returns a Net::DNS::Header object and the offset of the next location in the packet. Parsing is aborted if the header object cannot be created (e.g., corrupt or insufficient data). print $header->print; Prints the header record on the standard output. string print $header->string; Returns a string representation of the header object. id print "query id = ", $header->id, " "; $header->id(1234); Gets or sets the query identification number. qr print "query response flag = ", $header->qr, " "; $header->qr(0); Gets or sets the query response flag. opcode print "query opcode = ", $header->opcode, " "; $header->opcode("UPDATE"); Gets or sets the query opcode (the purpose of the query). aa print "answer is ", $header->aa ? "" : "non-", "authoritative "; $header->aa(0); Gets or sets the authoritative answer flag. tc print "packet is ", $header->tc ? "" : "not ", "truncated "; $header->tc(0); Gets or sets the truncated packet flag. rd print "recursion was ", $header->rd ? "" : "not ", "desired "; $header->rd(0); Gets or sets the recursion desired flag. cd print "checking was ", $header->cd ? "not" : "", "desired "; $header->cd(0); Gets or sets the checking disabled flag. ra print "recursion is ", $header->ra ? "" : "not ", "available "; $header->ra(0); Gets or sets the recursion available flag. ad print "The result has ", $header->ad ? "" : "not", "been verified " Relevant in DNSSEC context. (The AD bit is only set on answers where signatures have been cryptographically verified or the server is authoritative for the data and is allowed to set the bit by policy.) rcode print "query response code = ", $header->rcode, " "; $header->rcode("SERVFAIL"); Gets or sets the query response code (the status of the query). qdcount, zocount print "# of question records: ", $header->qdcount, " "; $header->qdcount(2); Gets or sets the number of records in the question section of the packet. In dynamic update packets, this field is known as "zocount" and refers to the number of RRs in the zone section. ancount, prcount print "# of answer records: ", $header->ancount, " "; $header->ancount(5); Gets or sets the number of records in the answer section of the packet. In dynamic update packets, this field is known as "prcount" and refers to the number of RRs in the prerequisite section. nscount, upcount print "# of authority records: ", $header->nscount, " "; $header->nscount(2); Gets or sets the number of records in the authority section of the packet. In dynamic update packets, this field is known as "upcount" and refers to the number of RRs in the update section. arcount, adcount print "# of additional records: ", $header->arcount, " "; $header->arcount(3); Gets or sets the number of records in the additional section of the packet. In dynamic update packets, this field is known as "adcount". data $hdata = $header->data; Returns the header data in binary format, appropriate for use in a DNS query packet. COPYRIGHT
Copyright (c) 1997-2002 Michael Fuhr. Portions Copyright (c) 2002-2004 Chris Reinhardt. Portions Copyright (c) 2007 Dick Franks. All rights reserved. This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
perl(1), Net::DNS, Net::DNS::Resolver, Net::DNS::Packet, Net::DNS::Update, Net::DNS::Question, Net::DNS::RR, RFC 1035 Section 4.1.1 perl v5.14.2 2009-12-30 Net::DNS::Header(3pm)
All times are GMT -4. The time now is 02:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy