Sponsored Content
Top Forums Shell Programming and Scripting Flat file-make field length equal to header length Post 302614031 by sonali.s.more on Wednesday 28th of March 2012 07:41:42 AM
Old 03-28-2012
Flat file-make field length equal to header length

Hello Everyone,

I am stuck with one issue while working on abstract flat file which i have to use as input and load data to table.

Input Data-

------ ------------------------ ---- -----------------
WFI001 Xxxxxx Control Work Item A Number of Records

------ ------------------------ ---- -------------------------
WFI001 Xxxxxx Control Work Item B Count of Distinct Hook Id

------ ------------------------ ---- -------------------
WFI001 Xxxxxx Control Work Item C Sum of Workitem Num

------ ---------------------- ---- -----------------
WFI008 Xxxxxx Control DocTABA A Number of Records

You can consider ----- as header for a field.
I cant starighforward load this file because if you check column values -they have spaces in them ;so i need to enclose indivisual column in double quotes.

Output i expect is
"WFI001" "Xxxxxx Control Work Item" "A" "Number of Records"
"WFI001" "Xxxxxx Control Work Item" "B" "Count of Distinct Hook Id "
"WFI001" "Xxxxxx Control Work Item" "C" "Sum of Workitem Num "
"WFI008" "Xxxxxx Control DocTABA" "A" "Number of Records "

Any help or suggestions in this query will be of great help.

Thanks!!!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

What the command to find out the record length of a fixed length file?

I want to find out the record length of a fixed length file? I forgot the command. Any body know? (9 Replies)
Discussion started by: tranq01
9 Replies

2. UNIX for Dummies Questions & Answers

Convert a tab delimited/variable length file to fixed length file

Hi, all. I need to convert a file tab delimited/variable length file in AIX to a fixed lenght file delimited by spaces. This is the input file: 10200002<tab>US$ COM<tab>16/12/2008<tab>2,3775<tab>2,3783 19300978<tab>EURO<tab>16/12/2008<tab>3,28523<tab>3,28657 And this is the expected... (2 Replies)
Discussion started by: Everton_Silveir
2 Replies

3. UNIX for Dummies Questions & Answers

Conditional sorting on fixed length flat file

I have a fixed length file that need to be sorted according to the following rule IF B=1 ORDER by A,B Else ORDER by A,C Input file is ABC 131 112 122 231 212 222 Output needed ABC 112 131 122 212 231 222 (1 Reply)
Discussion started by: zsk_00
1 Replies

4. Shell Programming and Scripting

Exporting a flat fixed length file (Urgent)

Hi All, So far, I've been extracting data from db2 tables and exporting the file as a tab delimited file into a UNIX server using the following command: export to /.../.../.../.../.../SM_RAW_DATA.dat of del modified by coldel| nochardel select a.accno, a.CUR_BL_AM, ... (1 Reply)
Discussion started by: jj2485
1 Replies

5. Shell Programming and Scripting

how to read fixed length flat file....

Hi Gurus, Thanks in advance... I am new to writing shell scripting and help me out reading a flat file with fixed length. I have a fixed length flat file with storename(lenth 6) , emailaddress(lenth 15), location(10). There is NO delimiters in that file. Like the following str00001.txt... (2 Replies)
Discussion started by: willywilly
2 Replies

6. Shell Programming and Scripting

reading fixed length flat file and calling java code using shell scripting

I am new to shell scripting and I have to to the following I have a flat file with storename(lenth 20) , emailaddress(lenth 40), location(15). There is NO delimiters in that file. Like the following str00001.txt StoreName emailaddress location... (3 Replies)
Discussion started by: willywilly
3 Replies

7. Shell Programming and Scripting

Make variable length record a fixed length

Very, very new to unix scripting and have a unique situation. I have a file of records that contain 3 records types: (H)eader Records (D)etail Records (T)railer Records The Detail records are 82 bytes in length which is perfect. The Header and Trailer records sometimes are 82 bytes in... (3 Replies)
Discussion started by: jclanc8
3 Replies

8. Shell Programming and Scripting

Make multiple files of equal length

I have 150 files with 4 columns each but variable row lengths that I need to combine by column. I do not have any common column. I want to use "paste " command in unix to do it but before that I have to get all my files to be of equal length. Is there a way using awk or sed to fill up n no. of... (7 Replies)
Discussion started by: manishabh
7 Replies

9. Shell Programming and Scripting

Fixed length flat file extraction

Hii ,I am new to Unix ,i have a flat file which is (fixed length) sitting in unix,Which is holding the data for a table.I want to extract one column(length7-10) on the basis of another column(length13-15) and want only one single row Example: Below is the sample of flat file. 1111 AAAA 100 ... (4 Replies)
Discussion started by: laxmi1166
4 Replies

10. UNIX for Dummies Questions & Answers

To flat file, append null or space if its length is less than 10

Hi, We receive flat files with fixed width data Now our goal is append from right null or space to each record if the lenght of the record is less than for example 10. for example 123 45 6 0 123 45 123 45 6 123 and output should be 123 45 6 0 123 45**** 123 45 6**... (7 Replies)
Discussion started by: shharrath
7 Replies
mod_esi(3erl)						     Erlang Module Definition						     mod_esi(3erl)

NAME
mod_esi - Erlang Server Interface DESCRIPTION
This module defines the API - Erlang Server Interface (ESI). Which is a more efficient way of writing erlang scripts for your Inets web server than writing them as common CGI scripts. EXPORTS
deliver(SessionID, Data) -> ok | {error, Reason} Types SessionID = term() Data = string() | io_list() Reason = term() This function is only intended to be used from functions called by the Erl Scheme interface to deliver parts of the content to the user. Sends data from a Erl Scheme script back to the client. Note: Note that if any HTTP-header fields should be added by the script they must be in the first call to deliver/2 and the data in the call must be a string. Do not assume anything about the data type of SessionID, the SessionID must be the value given as input to the esi call back function that you implemented. ESI CALLBACK FUNCTIONS
EXPORTS
Module:Function(SessionID, Env, Input)-> _ Types SessionID = term() Env = [EnvironmentDirectives] ++ ParsedHeader EnvironmentDirectives = {Key,Value} Key = query_string | content_length | server_software | gateway_interface | server_protocol | server_port | request_method | remote_addr | script_name Input = string() The Module must be found in the code path and export Function with an arity of two. An erlScriptAlias must also be set up in the configuration file for the Web server. If the HTTP request is a post request and a body is sent then content_length will be the length of the posted data. If get is used query_string will be the data after ? in the url. ParsedHeader is the HTTP request as a key value tuple list. The keys in parsed header will be the in lower case. SessionID is a identifier the server use when deliver/2 is called, do not assume any-thing about the datatype. Use this callback function to dynamically generate dynamic web content. when a part of the page is generated send the data back to the client through deliver/2 . Note that the first chunk of data sent to the client must at least contain all HTTP header fields that the response will generate. If the first chunk not contains End of HTTP header that is " " the server will assume that no HTTP header fields will be generated. Module:Function(Env, Input)-> Response Types Env = [EnvironmentDirectives] ++ ParsedHeader EnvironmentDirectives = {Key,Value} Key = query_string | content_length | server_software | gateway_interface | server_protocol | server_port | request_method | remote_addr | script_name. <v>Input = string() Response = string() This callback format consumes quite much memory since the whole response must be generated before it is sent to the user. This func- tions is deprecated and only keept for backwards compatibility. For new development Module:Function/3 should be used. Ericsson AB inets 5.5.2 mod_esi(3erl)
All times are GMT -4. The time now is 05:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy