Sponsored Content
Top Forums Shell Programming and Scripting Find the starting position in a file Post 302541993 by bobby1015 on Tuesday 26th of July 2011 10:29:09 AM
Old 07-26-2011
Find the starting position in a file

I have a file called "INPUT" which takes the following format

MNT-BANK-NUMBERO:006,00:N
MNT-100-ACCOUNT-NUMBERO:018,00:N
MNT-1000-DESCRIPTIONO:045:C
.
.
.
Now i got to find the displacements of the account numbers of each field of a file.

For the field MNT-BANK-NUMBERO:006,00:N, the account number starts from position 1 and ends at 6.
For the field MNT-515-ACCOUNT-NUMBERO:018,00:N, the account number starts from position 7 and ends at 24. Likewise for all other fields. Now I have to find the starting positions of all the fields with account numbers.

The output should take the following format

INPUT , 1, 7, and so on

Could you please help me out in solving this. Thanks

Help Help Help ....

Last edited by bobby1015; 07-26-2011 at 11:34 AM..
 

10 More Discussions You Might Find Interesting

1. HP-UX

find the position in a file and insert the data there

Hi, I have a EDI data file ARROWTEST of size 18246 characters. And I want to insert some data after 4200 position in the file. How I can find the position 4200 in that file....Please advise. Regards, (5 Replies)
Discussion started by: isingh786
5 Replies

2. Shell Programming and Scripting

how to find a position and print some string in the next and same position

I need a script for... how to find a position of column data and print some string in the next line and same position position should find based on *HEADER8* in text for ex: ord123 abs 123 987HEADER89 test234 ord124 abc 124 987HEADER88 test235 ... (1 Reply)
Discussion started by: naveenkcl
1 Replies

3. UNIX for Dummies Questions & Answers

find if a position is between a given start and end position

Hi, I am a newbie in unix programming so maybe this is a simple question. I would like to know how can I make a script that outputs only the values that are not between any given start and end positions Example file1: 2 30 40 80 82 100 file2: ID1 1 ID2 35 ID3 80 ID4 81 ID6... (9 Replies)
Discussion started by: fadista
9 Replies

4. Shell Programming and Scripting

How to put a word starting at particular position in a file using shell scripting

Hi all, I'm new to shell scripting and hence this query. I have 2 files. temp.txt and config.txt. The values in temp.txt are tab separated. ex: temp.txt AB CDE GHIJ OPQRS WXY ex:config.txt (1st line for 1st element of temp.txt and so on) start = '1' end='5' start = '6' end =... (26 Replies)
Discussion started by: subhrap.das
26 Replies

5. Shell Programming and Scripting

Find the position of a pattern on a line from a csv file

hello I'm doing a unix program and i'm using many file csv.in each csv file the colums are separated by ";" I would like to know the position of a pattern. For example for a line yyyy, bbbb, cccc; ddddd;eeee. I will like for example by finding the position of the pattern "cccc" and the response is... (6 Replies)
Discussion started by: papis
6 Replies

6. Shell Programming and Scripting

Remove the spaces at the end of a line starting from a fixed position

I want to remove the trailing spaces at the end of each line starting from a particular position(using ksh script). For example, in the attached file, I want to remove all the spaces starting from the position 430 till the end. The space has to be removed only from the 430th position no matter in... (3 Replies)
Discussion started by: Suryaaravindh
3 Replies

7. Shell Programming and Scripting

Grep starting from a specific position

Hello people, I'm scratch my head to find a solution to my problem, I'm absolutely sure this is very simple!!! :wall: I'm using the tcpdump to show on the screen in real time the UCP traffic: tcpdump -l -i bond1 -s 1514 -nntttt -A src or dst 192.168.1.5 and port 10000 | egrep "/51/"The output... (5 Replies)
Discussion started by: Lord Spectre
5 Replies

8. Shell Programming and Scripting

How to find character position in file?

how to find character positionin file? i.e string = "123X568" i want to find the position of character "X". Thanks (6 Replies)
Discussion started by: LiorAmitai
6 Replies

9. Shell Programming and Scripting

Find the position of a field/column in a flat file

Hi, Let say I have a file which has around 400 fields. SampleFile ========= PATIENTID|FACILITY|................|TIME_LAST_VISITED_BY_MD|.....|STATUS| How is it possible to find out which field is TIME_LAST_VISITED_BY_MD?fro example by seeing the above structure we can saw FACILITY... (5 Replies)
Discussion started by: machomaddy
5 Replies

10. Shell Programming and Scripting

Find position of character in multiple strings in a file

Greetings. I have a file with information like this: AMNDHRKEOEU?AMNDHRKEOEU?AMNDHRKEOEU?AMNDHRKEOEU? AMNDHRKEEU?AMNDHREOEU? AMNDHREU?AHRKEOEU?AMNDHRKEU?AMNDKEOEU? What I need to extract is the position, in every line, of every occurrence of '?' A desired output would be something... (6 Replies)
Discussion started by: Twinklefingers
6 Replies
asused(3pm)						User Contributed Perl Documentation					       asused(3pm)

NAME
asused - summaries address space used and according to the RIPE DB and REG. SYNOPSIS
asused [--all] [--aw | --approval] [--overlap] [--status | --assign[--pipa] ] regid asused [--all] [--aw | [--approval] [--overlap] [--status | --assign [--pipa] ] [--regid regid] (prefix ...) asused [--<options>] regid | prefix DESCRIPTION
asused is a tool to summaries address space is registered in the RIPE database. For each allocated inetnum object a summary of used and free address space is printed. A grant total summary for all prefixes is also provided. If there are no errors in locating allocations and and assignments under an allocation. In in the total % are calculated on total allocations. where: regid is name of registry as in registry database. prefix is allocation as in whois database. e.g. a.b.c/16 . Prefix is queried whois DB to find all Less specific matches inetnum with na as netname is interpreted as allocation and summerize the allocation. OPTIONS
--assign print all assignments under allocations, size, date and net name . Summary of assignments. And free address space. Summary of status attribute. --all this same as three options --overlap --status --aw. --approval Check the all networks in allocations are valid or not. Print valid and invalid networks. --aw only print invalid networks. --aw Check the all networks in allocations are valid or not. Print only Invalid networks. --approval will print valid and invalid. --contacts print admin-c/tech-c for all inetnums --help Shows the usage of asused. --overlap print the details of overlapping assignments. Summary of overlap per assignment is printed at the end. --reg regid. regid to locate the allocation. Netname of allocation is same as regid, translating the first '.' to '-' IN upper case. If not specified uses i2r to get regid. --status show assignments under allocations with wrong status attribute other than ASSIGNED PA or PI. MISSING for missing status. size and net name. Summary of assignments. No of Assignment(s) , No Assignments with status ASSIGNED PA or ASSIGNED PI, No Assignments with status ASSIGNED PI,No Assignments, No Assignments with Missing status attribute,No Assignments with other values status attribute, none of other . Warnings on assignments. OTHER OPTIONS
as3-option --port port query another whois server on the port. Default is 43. --host whoishost query another whois server. Default is whois.ripe.net. Can query only to RIPE whois server. Server version tested '2.1' --na netname show event table for approval of netname. Used with --aw or --approval -pipa additional flag to the --assign option to print allocation status in output. PA is for ALLOCATED PA, PI - ALLOCATED PI, UN for UNSPECIFED, -- is for missed status field. --version print version of asused. DIAGNOSTICS
No allocations from reg Could not locate any allocations in use from registry. No allocations from DB No inetnum object was recognized as allocation in the RIPE Database. % No entries found for the selected source(s). No assignment(s) found under the allocation. May be a new allocation or allocation which has no objects in RIPE DB. Not sure to treat as 100 % free. ERROR MISMATCH Netname regid RIPE DB Netame attribute has mismatch with na or regid. ERROR STATUS May be incorrect status attribute in the RIPE DB, Valid status ALLOCATED (PA|PI|UNSPECIFIED) ERROR mnt-byInvalid <mnt-by> attribute in RIPE DB expecting RIPE-NCC-MNT|RIPE-NCC-HM-MNT|RIPE-NCC-HM-PI-MNT Inconsistent with inetnum Encountered two inetnum objects with same logical start and end. Logical interpretation of inetnum a.b.c.0 => a.b.c.0 - a.b.c.255; a.b.c.0 - a.b.d.0 => a.b.c.0 - a.b.d.255 Classfull notation Intrepreted as class full object. Check if no of address are counted correctly. Multiple inetnum When tried to locate an allocation inetnum object for regid prefix from RIPE DB with option -L -F -T prefix returned multiple objects. Every prefix can have only one allocation object. NOT Counted Assignment If the assignment is outside the boundaries of allocation. It was returned by -M query RIPE whois server. Invalid inetnum Logical interpretation of inetnum fails. Probably can not identify start, end of end < start. Assignments has Invalid Date one of the dates of inetnum in the changed attribute is invalid. REQUIRES
Perl 5.00404 or later. Connection to RIPE whois server V 2.1, Perl Modules Socket Getopt::Long, regread, ipv4pack BUGS
Could give incorrect summary if logical interpretation of Inetnum is not exact a.b.c.0 - a.b.c.0 is intended to be an assignment of size 1 IP No. Out of memory! Noticed that when the no of assignments are very large, like 5000+ per allocation default data segment size of BSDI 3.1 is not enough. Increasing to 64 M Bytes may help. in bash shell ulimit -d 65536 eg. de.schlund IANA Delegated blocks smaller than /8 If the allocations are outside 192,193,194,195,212 /8 and LIR allocation is same inetnum as in /ncc/ip-reg/delegations asused2 will return No allocations in RIPE DB. eg. de.callisto SEE ALSO
whois reg i2r regread Reg::Asused Reg::Approved Net::RIPEWhois AUTHOR
Antony Antony <antony@ripe.net> . RIPE NCC software group. <softies@ripe.net> POD ERRORS
Hey! The above document had some coding errors, which are explained below: Around line 46: You forgot a '=back' before '=head1' Around line 66: You forgot a '=back' before '=head1' You forgot a '=back' before '=head1' Around line 95: You forgot a '=back' before '=head1' perl v5.10.1 2003-10-07 asused(3pm)
All times are GMT -4. The time now is 06:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy