Tried anything yourself? What failed / went wrong?
What do you mean by "fixed length file"? Even though a program could use a x-count byte raster to read & interpret data in a file, I don't think this is a usual style / file type in *nix. You mayhap mean a text file with a fixed line length? This you can achive in SQL itself using some formatting commands, I'm sure.
All i tried was:
1. Create a Jun_07142014.sql file, with the following code.
2. Then, on the command line to generate the Jun_07142014.out file.
3. Then open the Jun_07142014.out file and remove the double quotes and pipe (|) delimiters.
I want to be able to do all that in a script so that, when i run that script, it automatically generates the output file.
Can you extract the data you need running this from a shell script?
How long are the lines and how long should they be?
Why do you get pipes and quotes in the output? Is it in the source data?
Does your query language support commands such these
SET LINESIZE 4000
COLUMN x FORMAT A20
I'm still a little unclear as to what output you want. RudiC did ask, but you didn't answer. Do you want a fixed line length file, fixed width columns or are you planning to FTP this to a mainframe where you can define data as fixed record?
If you could help us to understand your need, then perhaps we will be better placed to help you with a solution.
Firstly, i have a SQL script.
I'm doing a "EXPORT TO SL_JUN_07142014.asc of del modified by coldel|" before the SQL script so that, the columns are separated by a "|".
Then since, i'm directing this output to a .out file, it is wrapping each field with double quotes.
The SQL script itself has the lengths needed for each field. I want to retain those lengths; that's all.
I'm using DB2 UDB. I'm not sure, i follow your question.
These are Oracle SQL statements. I'm not sure if they follow some greater standard, but the first tries to define the output line as 4000 characters wide (probably a bit excessive) and the second is to force each column to a specified width. If you set each column to a fixed size, then the output should be fixed width fields for each record.
Sorry if I've confused things.
Can you post a sample of what you can generate already from your script and tell us what is needs to look like? Feel free to sanitise it, but make sure that the columns still match the required length. We should be able to work with that and ignore the 'how it gets extracted' bit.
Hi All,
I need to convert a fixed length file to a delimited file with , (comma). But not all columns, some of the columns in the fixed files are used as fillers and I do not need that in the output file.
test_fixed_len.txt
I 0515 MR 394
I 0618 MR & MRS 942
I 0618 MR & MRS... (7 Replies)
Hi Everyone,
I need to increment a value in the fixed length file. The file has almost a million rows. Is there any easy way to accomplish this.
Ex
input file
ASDSD ADSD 00000 X
AAASD ADSD 00000 X
SDDDD ADSD 00000 X
Ouput
ASDSD ADSD 00001 X
AAASD ADSD 00002 X
SDDDD ADSD 00003 X
... (7 Replies)
I have a fixed width file of length 53. when is try to get the lengh of the record of that file i get 2 different answers.
awk '{print length;exit}' <File_name>
The above code gives me length 50.
wc -L <File_name>
The above code gives me length 53.
Please clarify on... (2 Replies)
I have a peculiar file with record format like given below. Each line is wrapped to next lines after certain number of characters. I want to concatenate all wrapped lines into 1.
Input:(wrapped after 10 columns)
This is li
ne1
This is li
ne2 and
this line
is too lo
ng
Shortline
... (8 Replies)
Hi,
I have a file which have set of rows and has to create separate files based on the id.
Eg:
001_AHaris020
001_ATony030
002_AChris090
002_ASmit060
003_AJhon001
Output: I want three files like 001_A.txt, 002_A.txt and 003_A.txt.
001_A.txt should have
... (4 Replies)
Need a script that manipulates a fixed length file that will compare 2 fields in that file and if they are equal write that line to a new file.
i.e. If fields 87-93 = fields 119-125, then write the entire line to a new file. Do this for every line in the file. After we get only the fields... (1 Reply)
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)
consider a fixed length file
12345abcd8901
12345abcd7777
12345njdu8888
12345hdku8388
i would like to dump it in to oracle DB using sql loader
12345 in to first coloumn
abcd in to second coloumn
8901 in to 3rd coloumn (2 Replies)
Is there a command that sets a variable length?
I have a input of a variable length field but my output for that field needs to be set to 32 char.
Is there such a command?
I am on a sun box running ksh
Thanks (2 Replies)