07-17-2008
hi let me explain with a quick example:
Input text file
CUST PREM RATE LOS CODE DATE REAS TYPE
========= ======= ==== ==== ==== =========== ==== ====
8174739 7641509 1S NONE CRCD 30-JUN-2008 NPAR N
Output required in CSV file:
8174739 ,7641509,1S ,NONE,CRCD,30-JUN-2008,NPAR,N
In the input file mentionned the field lengths are as below:
1st field --> 9 bit long
2nd field --> 7 bit long
3rd field --> 4 bit long
4th field --> 4 bit long
5th field --> 4 bit long
6th field --> 11 bit long
7th field --> 4 bit long
8th field --> 1 bit long
but the value of the first field CUST in the input record, has only 7 bit. So with the input 7 bit value i will pad 2 bit spaces and then the 10th bit will be a seperator "," in the output csv file.
The next field is the PREM which is actually 7 bit long and the value in this field is also 7 bit long, so the 8th bit will be a seperator "," in the output csv file.
finally my output csv file will be as below:
8174739 ,7641509,1S ,NONE,CRCD,30-JUN-2008,NPAR,N
Please let me know if the explanation is clear.
Thanks !
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello
I need help to convert flat file data to HTML Table format.
I am generating everyday Flat file and want to convert into HTML Table format.
The format of my file is:
version host Total YRS NO APPS PSD
10 Sun 30 2 4 6 7
and flat... (11 Replies)
Discussion started by: getdpg
11 Replies
2. Shell Programming and Scripting
Please help
Need a script which will do the following :
Search on fixed width file , go to position (25,2) which means 25th and 26th position, Find if there are any char in lower case:
For example 25,2 can be (9T) or (9w) or (Ww) or (wW)....The two positions can be numeric or alpha...no... (13 Replies)
Discussion started by: ssantoshss
13 Replies
3. Shell Programming and Scripting
Hi Guy's can someone help me in converting the following
I have a flat text file which has several thousand lines which I need to convert to a csv it's got a consistent format but basically want every time it hit's txt to create a new line with the subsequent lines comma delimited for example
... (6 Replies)
Discussion started by: p1_ben
6 Replies
4. Programming
hi...... thanks for allowing me to start a discussion
i am collecting usb usage details of all users and convert it into csv files so that i can export it into some database..
the input text file is as follows:-
USB History Dump
by nabiy (c)2008
(1) --- Kingston DataTraveler 130 USB... (2 Replies)
Discussion started by: certteam
2 Replies
5. Shell Programming and Scripting
Hi, could some help me convert CSV file (with double quoted strings) to pipe delimited file:
here you go with the same data:
1,Friends,"$3.99 per 1,000 listings",8158here " 1,000 listings " should be a single field.
Thanks,
Ram (8 Replies)
Discussion started by: Ram.Math
8 Replies
6. Shell Programming and Scripting
hi
i have written a script for reading a csv file and creating a flat file, suggest if this script can be optimized
#----------------
FILENAME="$1"
SCRIPT=$(basename $0)
#-----------------------------------------//
function usage
{
echo "\nUSAGE: $THIS_SCRIPT file_to_process\n"... (3 Replies)
Discussion started by: mprakasheee
3 Replies
7. Shell Programming and Scripting
Hi ,
I have a simple text file with contents as below:
12345678900 971,76 4234560890
22345678900 5971,72 5234560990
32345678900 71,12 6234560190
the new csv-file should be like:
Column1;Column2;Column3;Column4;Column5
123456;78900;971,76;423456;0890... (9 Replies)
Discussion started by: FreddyDaKing
9 Replies
8. Shell Programming and Scripting
Hi all,
I need to find a way to convert excel file into csv or a text file in linux command. The reason is I have hundreds of files to convert. Another complication is the I need to delete the first 5 lines of the excel file before conversion.
so for instance
input.xls
description of... (6 Replies)
Discussion started by: johnkim0806
6 Replies
9. UNIX for Dummies Questions & Answers
Hi I have a file like this:
a=1
b=2
c=3
a=4
b=2
d=3
a=3
c=4
How can I change this to csv format
a,b,c,d
1,2,3,,
4,2,,3
3,,4,,
Please use code tags next time for your code and data. Thanks (10 Replies)
Discussion started by: sandip_2014
10 Replies
10. Shell Programming and Scripting
Hi All,
I have a csv file which is comma seperated. I need to convert to flat file with preferred column length
country,id
Australia,1234
Africa,12399999
Expected output
country id
Australia 1234
Africa 12399999
the flat file should predefined length on respective... (8 Replies)
Discussion started by: rohit_shinez
8 Replies