Sponsored Content
Top Forums Shell Programming and Scripting Parsing a line in Shell Script Post 302143493 by unishiva on Thursday 1st of November 2007 04:30:20 PM
Old 11-01-2007
Sorry for the confusion

Let me put it simple ..I wanted crate two lines by parsing one lin by exracting certian fields

I have record line somthing like below (Origanal line before Parsing)

DF02000XXYYYY00200.89ZZPPPP00800

Field discription :
DF - FirstField (Character Position 1 to 2)
02000 - Second Field (Characters position 3 to 7)
XX third Field (Characters position 8 to 9)
YYYY Fourth Field (Characters position 10 to 13)
00200.89 fifth Field (Characters position 14 to 21)
ZZ sixth Field (Characters position 22 to 23)
PPPP seventh Field (Characters position 24 to 27)
00800 eightth Field (Characters position 28 to 32)

I wanted to create two new line by parsing above line (each line having again 7 fields)
1st line should loolk line
DF0120000000000000000000000000000
DF - First Field (Same as that of origanal iine)
01200 - Second Field ( This is Difference between 2ndfiled and 8th Field of origanla line)

All other fields are 0's

2nd Line should look like
DF00800XXYYYY00200.89ZZ000000000

DF - First Field (Same as that of origanal iine)
00800 - Second Field ( This is same as that of the 8th Field of Origanal line)
XX - thrid field same as that of origanal line
YYYY - fourth field Same as that of the origanal line
00200.89 - Fifth field same as that of orignal line
All other fields should be zeros

I hope this time it is clear. If you still some clarification .. I will write back.
Thanks for all your help.

Thanks
Uni
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Parsing text from one line with shell scripts

Hi Gurus! I wonder if anyone can help me, I'm sure you guys can. I have a text file which contains a lot of data on the one line as follows: $ What I need to do is pull all of those id values out (eg 2549425) and write them to a list in a text file. Any help would be greatly... (3 Replies)
Discussion started by: th3g0bl1n
3 Replies

2. UNIX for Dummies Questions & Answers

shell script parsing with sed

#I'm quite new to scripting and my boss has asked me to solve a simple problem and sadly, I can't figure out how to do it. Any help is appreciated. :confused: #The following is a small shell script and the output that it produces for google.com. #!/bin/sh whois $1 | grep "Name Server"... (5 Replies)
Discussion started by: jjamd64
5 Replies

3. Shell Programming and Scripting

Shell script to parsing log

Hi I Have log like this : 0 234: { 3 2: 04 EE 7 14: '20081114081' 23 1: 00 79 10: '38809' 91 15: '528111510010159' 143 29: 'Streaming/downloading service' 174 3: 'MTV' 179 43: 'rtsp://172.28/MTV2GO-Loop.sdp' 224 1: 05 ... (10 Replies)
Discussion started by: justbow
10 Replies

4. Shell Programming and Scripting

Parsing XML using Shell Script

Hello, I'm a starting shell scripter and no Perl knowledge. I've trying to do this for a while: I want to parse an XML file and get certain data out of it and write that data into a CSV file, all this using Shell Scripting (in Bash). Or Perl without any XML Parser/Interpreter (if possible). ... (1 Reply)
Discussion started by: Kage Musha
1 Replies

5. Shell Programming and Scripting

XML parsing using shell script

I have a xml file like this <bul:collectionStrategy name="strategy1"> <bul:collectionTemplateGroup name="15min group"/> <bul:collectionTemplateGroup name="hourly group"/> </bul:collectionStrategy> <bul:CollectionTemplateGroup name="hourly group" > ... (2 Replies)
Discussion started by: LavanyaP
2 Replies

6. Shell Programming and Scripting

parsing using shell script

I have a file parameters.txt which contains 151524 151525 I have another file OID.csv which contains NE Version Object Type ID SDK param name Object OID test1 Start: 4.2 End: 4.2 pan 151524 speed ... (5 Replies)
Discussion started by: LavanyaP
5 Replies

7. Shell Programming and Scripting

Parsing a command line parameter in script

I have a simple script that builds a complex program call which passes a number of parameters to the program. I'm trying to enhance the script to include the value of the command line parameter in the name of a file being created. The problem I'm having is that the parameter may include a forward... (11 Replies)
Discussion started by: pbmax626
11 Replies

8. Shell Programming and Scripting

Parsing XML using shell script

Well, issue is i have to parse this script to get the VERSION: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleAllowMixedLocalizations</key> ... (9 Replies)
Discussion started by: zorosinister
9 Replies

9. Shell Programming and Scripting

Parsing line with name:value pairs in shell script

HI , I have the following type of lines in a file and need to create a csv file that can be bcp'ed into a db The problem that I have is the delimited of the <name :value> is a space but some of the values in the pairs have space . eg msg_src_time:03/05/13 10:40:17.919 Need sugesstions on... (9 Replies)
Discussion started by: tasmac
9 Replies

10. Shell Programming and Scripting

Parsing Command Line Arguments In C shell script

]I have a string like "/abc/cmind/def/pq/IC.2.4.6_main.64b/lnx86" and this string is given by user. But in this string instead of 64b user may passed 32 b an i need to parse this string and check wether its is 32b or 64 b and according to it i want to set appropriate flags. How will i do this... (11 Replies)
Discussion started by: codecatcher
11 Replies
SHAPELIB(1)							   User Commands						       SHAPELIB(1)

NAME
dbfdump - dump xBase DBF files as text SYNOPSIS
dbfdump [-h] [-m] [-r] file DESCRIPTION
Dumps the contents of file to standard output. The first line contains the field names appearing in file, and each of the following lines contains the field values of a record. Field names and values are padded by spaces to their field widths. Empty fields are printed as the string "(NULL)". OPTIONS
-h Prints the column field definitions before other output. Each field definition consists of a line of the form Field: index, Type=type, Title=`name', Width=width, Decimals=precision where index is the zero offset column number of the field; the type indicates the datatype of the field value and is either "Inte- ger", "Real" or "String"; name is the field's name; width is the number of bytes reserved for the field's value; and precision is the number of decimal places of precision for "Real" type fields, and is zero for "Integer" and "String" type fields. -m Prints each record in multiline format separated by empty lines. The first line of a record gives the number of the record in the form Records: record_index where record_index is the zero offset number of the record in the file, and then each field of the record appears on its own line in the format name: value -r Prints the exact bytes occurring in file for field values and suppresses printing "(NULL)" for empty values. EXIT STATUS
0 Successful program execution. 1 Missing file argument. 2 Failed to open file. 3 There are no fields in file. DIAGNOSTICS
The following diagnostics may be issued on stdout: DBFOpen(file,"r") failed. There are no fields in this table! AUTHORS
Frank Warmerdam (warmerdam@pobox.com) is the maintainer of the shapelib shapefile library. Joonas Pihlaja (jpihlaja@cc.helsinki.fi) wrote this man page. BUGS
Unless the -r option is given, values in numeric fields that overflow the int or double types of the C language are printed as plus or minus a huge number. For integer fields the huge value is HUGE_VALL from <stdlib.h> and for real fields it is HUGE_VALF. SEE ALSO
dbf_dump(1), dbfcreate(1), dbfadd(1), shpadd(1), shpcreate(1), shpdump(1), shprewind(1) shapelib OCTOBER 2004 SHAPELIB(1)
All times are GMT -4. The time now is 11:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy