Sponsored Content
Top Forums Shell Programming and Scripting File splitting according to the length of the fields Post 302946437 by nua7 on Tuesday 9th of June 2015 08:24:14 AM
Old 06-09-2015
File splitting according to the length of the fields

Hi All,
I have two files:
1> Data file
2> info file which has field lengths and start position.

Is there a way to create a comma delimited file according to the fields length and start position.

Data file :
HTML Code:
R-0000017611N-00000350001095ANZU01
A00000017611N000000350001095ANZU02
R-0000019427N-00000265001202BGYI03
R-0000005977N-00000092001202BGYI03
R-0000017195N-00000995001353B1IZ03
A00000099500N000000995001353B1IZ04
R-0000258547N-00002266002019AXAJ01
A00000258547N000002266002019AXAJ02
R-0000012277N-00000216002026BLCF03
A00000012277N000000216002026BLCF04
HTML Code:
Field Name	Length	Start Position

ADJ-TYPE-CODE	1	1
ALLOW-AMT	11	2
CAP-SRVC-NO	1	13
BILL-AMT	11	14
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help in splitting a line into fields in shell scripting

I have a line of more than 3000 bytes which will contain & as fields separator..I am using following awk command ..Its working but its not accepting the line more than 3000 bytes...Anyother alternate solution even in othe shell command also fine... awk -F '&' '{for( i=1; i<=NF; i++ ) print $i}'... (2 Replies)
Discussion started by: punithavel
2 Replies

2. Shell Programming and Scripting

Need awk script to compare 2 fields in fixed length file.

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)
Discussion started by: Muga801
1 Replies

3. Shell Programming and Scripting

Fixed length fields

HPUX and posix shell Hi all. I have a record with fixed length fields....I would like to reorder the fields and preserver the fixed lengths.... cat test 4 960025460 Dept of Music 8 960025248 Dept of Music 12-08 cat... (3 Replies)
Discussion started by: lyoncc
3 Replies

4. Shell Programming and Scripting

Help with splitting fields

Hi. I want to put the first field to the end and the lines are of different number of fields. How should I do this with awk? Thanks. (3 Replies)
Discussion started by: dustinwang2003
3 Replies

5. Shell Programming and Scripting

Splitting fixed length file using awk

Hi, I need to split a fixed length file of 160 characters based on value of a column. Example: ABC 456780001 DGDG SDFSF BCD 444440002 SSSS TTTTT ABC 777750003 HHHH UUUUU THH 888880001 FFFF LLLLLL HHH 999990002 GGGG OOOOO I need to split this file on basis of column from... (7 Replies)
Discussion started by: Neelkanth
7 Replies

6. Shell Programming and Scripting

Splitting a column in two separate fields

for making a summary I have a CSV file which is transformed to .DAT. I have an AWK file which is supposing to do the mapping of the DAT file. The code from the AWK file is the one below. The content of the DAT file looks like this (tab separated): ODT AGE CDT CO SEX TIME VALUE COMMENT ... (1 Reply)
Discussion started by: grikoss
1 Replies

7. Shell Programming and Scripting

Help in splitting Sub Fields and compare with other field

Hi All, We are trying to pull out data from below table, the table contains four fields and out of which last two fields are having sub-fields with delimiter $, we want to identify number "1" position in the 3rd field and from 4th field need to extract the information from the same position. ... (4 Replies)
Discussion started by: rramkrishnas
4 Replies

8. Shell Programming and Scripting

Splitting a filed into multiple fields using awk

Hi, I have a tab delimited file as below: AWA Divi DD01 None 1 2 Room AC 01-MAY-15 31-OCT-15 OT 01-MAY-15 31-OCT-15 CF 01-MAY-15 31-OCT-15 AW0 Beach DD02 None 1 2 Double AC 01-MAY-15 31-OCT-15 AD 01-MAY-15 31-OCT-15 The number of columns(fields) after 7th field is not fixed and... (3 Replies)
Discussion started by: Bobby_2000
3 Replies

9. Shell Programming and Scripting

Splitting multiple fields of /usr/bin/id

Hi, Iv got the following input $id |grep uid uid=6090(dsiddiq) gid=1(staff) groups=4001(cdgrp) and Im using the below command to split the field to grab the numberical userid as well the alphabetical userid $id|awk -F'=' '{print $2}'|awk -F')' '{print $1}'|awk -F'(' '{print $1" "$2}'... (4 Replies)
Discussion started by: dsid
4 Replies

10. UNIX for Beginners Questions & Answers

Splitting the file based on two fields - Fixed length file

Hi , I am having a scenario where I need to split the file based on two field values. The file is a fixed length file. ex: AA0998703000000000000190510095350019500010005101980301 K 0998703000000000000190510095351019500020005101480 ... (4 Replies)
Discussion started by: saj
4 Replies
HTML::FormHandler::Field::Password(3pm) 		User Contributed Perl Documentation		   HTML::FormHandler::Field::Password(3pm)

NAME
HTML::FormHandler::Field::Password - password field VERSION
version 0.40013 DESCRIPTION
The password field has a default minimum length of 6, which can be easily changed: has_field 'password' => ( type => 'Password', minlength => 7 ); It does not come with additional default checks, since password requirements vary so widely. There are a few constraints in the HTML::FormHandler::Types modules which could be used with this field: NoSpaces, WordChars, NotAllDigits. These constraints can be used in the field definitions 'apply': use HTML::FormHandler::Types ('NoSpaces', 'WordChars', 'NotAllDigits' ); ... has_field 'password' => ( type => 'Password', apply => [ NoSpaces, WordChars, NotAllDigits ], ); You can add your own constraints in addition, of course. If a password field is not required, then the field will be marked 'noupdate', to prevent a null from being saved into the database. ne_username Set this attribute to the name of your username field (default 'username') if you want to check that the password is not the same as the username. Does not check by default. AUTHOR
FormHandler Contributors - see HTML::FormHandler COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Gerda Shank. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-06-25 HTML::FormHandler::Field::Password(3pm)
All times are GMT -4. The time now is 09:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy