Sponsored Content
Top Forums Shell Programming and Scripting Making changes in the fields of a record Post 302217994 by kanu_pathak on Thursday 24th of July 2008 03:40:51 AM
Old 07-24-2008
Making changes in the fields of a record

Smilie
Hi Friends,

In the record below i have to make changes in the fields by putting the values stored in the temporary variables, x, y, z, p, q, r:

Code:
2)	In the TBT record store the values in the various fields as: 
             a)	X in a field position       51 to 56
             b)	Y in a field position       57 to 68
             c)	Z in a field position       69 to 74
             d)	P in a field position        75 to 86
             e)	Q in a field position       87 to 92
             f)          R in a field postion        93 to 104



Code:
TBT0000271422981977           50100001      08071400001100000015011500000100000000772700001200000014238H


Please sujjest me how to make changes through awk if it is possible ...


Thanks
Kanu
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to screen each variable record for right # of fields

Hi, In a script I have to check that input text files with a variable number of tab delimited fields have at least n fields and no more than m fields. Records are delimited by <CR> and <LF>. I have figured out code that will strip out all the alpha-numeric characters, convert the tabs to... (3 Replies)
Discussion started by: jvander
3 Replies

2. Shell Programming and Scripting

awk: record has too many fields

Hi, I'm trying this command - but get this error. Do you guys have any workaround for this? cat tf|sed 's/{//g'|sed 's/,//g'|awk '{for (i=1;i<=NF;i++) {if ($i == "OPTIME") {k = i + 2; print $i,$k}}}' awk: record `2005 Jul 28 17:35:29...' has too many fields record number 15 This is how... (3 Replies)
Discussion started by: chaandana
3 Replies

3. Shell Programming and Scripting

Manipulating fields record wise

Hi all, I have an input file with no delimiter. Let us say the file is abc.txt having values for fields namely, EmpNumEnameDesigSalDept. Ofcourse the file has got several records. Every field has got a fixed start and end position. I need to assign the fields to corresponding varibles say... (1 Reply)
Discussion started by: rinku11
1 Replies

4. Shell Programming and Scripting

How count number of fields in a record

Dear All , I have the query cat temp.txt |28-07-1997|IF_LEG_DCCT|TOV JV sdfsdfdsfdsfdsCLOSED* KIEV|381015280 I need to count the number of fields in this pipe-seperated file. I beleive this is possible via AWK command. The in above file, output of the count should be 5.... Can some-one... (5 Replies)
Discussion started by: sureshg_sampat
5 Replies

5. Shell Programming and Scripting

Print all the fields of record using awk

Hi, i want to generate print statement using awk. i have 20+ and 30+ fields in each line Now its priting only first eight fields print statement as output not all. my record is as shown below filename ... (2 Replies)
Discussion started by: raghavendra.nsn
2 Replies

6. Shell Programming and Scripting

Compare fields and keep record with bigger ID?

How do you write a shell script to compare records with the same fields then keep the biggeer id number fields (field separate by a pipe) 1150| San Jose|8|15|7|2013-02-19 00:00:00.000|2013-02-20 00:00:00.000 1263|San Jose|8|15|7|2013-02-19 00:00:00.000|2013-02-20 00:00:00.000... (4 Replies)
Discussion started by: sabercats
4 Replies

7. Shell Programming and Scripting

Newline between unequal record fields

Assume the following 5 records (field separator is a space): 0903 0903 0910 0910 0910 0910 0910 0910 0917 0917 0917 0917 0924 1001 1001 1001 1001 1008 1008 1008 1008 1015 1015 1015 1015 1022 1029 1029 1029 1029 1105 1105 1105 1105 1112 1112 1112 1112 1119 1126 1126 1126 1126 1203 1203 1203 1203... (8 Replies)
Discussion started by: tree
8 Replies

8. Shell Programming and Scripting

Delete last 2 fields from every record in a file

Sample file record : "20130617003","2013-06-18T07:00:03","OUTWARD","01001011","TEST PLC","","HFX834346364364","20130617","10","DUM87534758","","1.28","826","020201","65879278","","","","","","010101","56789","DUMMY... (3 Replies)
Discussion started by: bigbuk
3 Replies

9. Shell Programming and Scripting

awk - compare 1st 15 fields of record with 20 fields

I'm trying to compare 2 files for differences in a selct number of fields. When differnces are found it will write the whole record of the second file including appending '|C' out to a delta file. Each record will have 20 fields, but only want to do comparison of 1st 15 fields. The 1st field of... (7 Replies)
Discussion started by: sljnk
7 Replies

10. Shell Programming and Scripting

Strip the first record off a file and isolate fields off of it

I have a 2 part question on how to this in unix scripting using kshell or c shell. I have a file described below: 1st record has 2 fields on it every other record has 22 fields on it. Example ABC, email address Detail 1 Detail 2 Detail 3 . . . 1st question is... (4 Replies)
Discussion started by: jclanc8
4 Replies
Field(3pm)						  LogReport's Lire Documentation						Field(3pm)

NAME
Lire::Field - Interface to Dlf field's specification. SYNOPSIS
my $field = $schema->field( 'time' ); print "Name: ", $field->name(), " ", "Type: ", $field->type(), " "; DESCRIPTION
This module represents Dlf field's specifications. You'll get reference to this kind of object when you call the field(), timestamp_field() or fields() methods on a Lire::DlfSchema(3pm) object. You can obtain information about this field by querying its methods. OBJECT METHODS
name() Returns the name of the field. label() Returns the default label that should be used for column containing values from this field. pos() Returns the field's position in the record. Field's positions are indexed from 0. type() Returns the field's type. This will be a string describing the type's name as used in the XML specifications. sql_type() Returns the SQL type that should be used to hold this field's values. default() This method is obsolete since field don't have default anymore. description() This method will return the field's description. (This is the content of the description element in the XML specification.) Be aware that this will most likely contains DocBook markup. SEE ALSO
Lire::DlfSchema(3pm) Lire::DataTypes(3pm) AUTHORS
Francis J. Lacoste <flacoste@logreport.org> Wolfgang Sourdeau <wolfgang@logreport.org> VERSION
$Id: Field.pm,v 1.18 2006/07/23 13:16:29 vanbaal Exp $ COPYRIGHT
Copyright (C) 2001-2004 Stichting LogReport Foundation LogReport@LogReport.org This file is part of Lire. Lire is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (see COPYING); if not, check with http://www.gnu.org/copyleft/gpl.html. Lire 2.1.1 2006-07-23 Field(3pm)
All times are GMT -4. The time now is 01:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy