Sponsored Content
Top Forums Shell Programming and Scripting Inserting a field without disturbing field separator on other fields Post 302972943 by am24 on Thursday 12th of May 2016 04:21:07 AM
Old 05-12-2016
Hi pravin27,

Thanks for the reply. I have modified the loop as you suggested. In the output , 2.979 placed in 20th field and 76.265 placed in 19th field.

So i just modified as below:

Code:
for (i=2; i<=CNF+2; i++) {printf "%7s", T[i]; if ( i == 18) {printf "%7s", " 2.979"}}

Now the value 2.979 is placed in 19th field and 76.265 in 20th field. and all other fields placed correctly.

Also i have question that , if 2.979 value is stored in one variable, then can i assign it to T[19] ?

Reason for this is, the 2.979 is not constant value, i am taking the value from some other file. So if i pull out the value from the file and store it in one variable then can i assign the variable value to array element ?

I have tried something on this but did not get the proper result.

Thanks in advance,
am24
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to include field separator if there are blank fields?

Hi, I have the following data in the format as shown (note: there are more than 1 blank spaces between each field and the spaces are not uniform, meaning there can be one blank space between field1 and field2 and 3 spaces between field3 and field4, in this example, # are the spaces in between... (19 Replies)
Discussion started by: ReV
19 Replies

2. Shell Programming and Scripting

Sorting on two fields time field and number field

Hi, I have a file that has data in it that says 00:01:48.233 1212 00:01:56.233 345 00:09:01.221 5678 00:12:23.321 93444 The file has more line than this but i just wanted to put in a snippet to ask how I would get the highest number with time stamp into another file. So from the above... (2 Replies)
Discussion started by: pat4519
2 Replies

3. Shell Programming and Scripting

Field separator in awk

Hi I need to check if field separator I am using in awk statement is " : ", for example: TIME=12:59 HOUR=`echo "$TIME" | awk '{FS=":"; print $1}'` MINUTES=`echo "$TIME" | awk '{FS=":"; print $2}'` Is there a way to check within the above awk statement ? Thanks for help -A (2 Replies)
Discussion started by: aoussenko
2 Replies

4. Shell Programming and Scripting

awk, comma as field separator and text inside double quotes as a field.

Hi, all I need to get fields in a line that are separated by commas, some of the fields are enclosed with double quotes, and they are supposed to be treated as a single field even if there are commas inside the quotes. sample input: for this line, 5 fields are supposed to be extracted, they... (8 Replies)
Discussion started by: kevintse
8 Replies

5. Shell Programming and Scripting

Field separator X'1F'

Hi, I have a flat file with fields separated by a X'1F' i have to fetch 4th field from second line. please help me how to achieve it. I tried with below command and its not working. cut -f4 -d`echo -e '\x1f'` filename.txt I am using SunOS. Thanks in advance. (2 Replies)
Discussion started by: rohan10k
2 Replies

6. Shell Programming and Scripting

echo field separator

I am trying to echo all fields except for the last field. I want to include the field seperator, but it is removed. echo "a;s;v;g" | awk -F ";" '{$(NF--)=""; print}' a s v I want an output like this: a;s;v; (3 Replies)
Discussion started by: locoroco
3 Replies

7. Shell Programming and Scripting

Inserting a new field inbetween two exisitng field

I have a '|' delimited file. My file looks like below 23|nationalhoilday|feb12||||||||||||||california|northdistrict|| In the same way, each record has 164 fields. I have to insert one more field after the 85th field. Expected output... (3 Replies)
Discussion started by: machomaddy
3 Replies

8. UNIX for Dummies Questions & Answers

change field separator only from nth field until NF

Hi ! input: 111|222|333|aaa|bbb|ccc 999|888|777|nnn|kkk 444|666|555|eee|ttt|ooo|ppp With awk, I am trying to change the FS "|" to "; " only from the 4th field until the end (the number of fields vary between records). In order to get: 111|222|333|aaa; bbb; ccc 999|888|777|nnn; kkk... (1 Reply)
Discussion started by: beca123456
1 Replies

9. Shell Programming and Scripting

awk field separator help -

Hi Experts , file : - How to construct the awk filed separator so that $1, $2 $3 , can be assigned to the each "" range. I am trying : awk -F"]" '{print $1}' but it is printing the entire file. Not first field. The desired output needed for first field... (9 Replies)
Discussion started by: rveri
9 Replies

10. Shell Programming and Scripting

Field separator

Hello All, I have a file, but I want to separate the file at a particular record with comma"," in the line Input file APPLE6SSAMSUNGS5PRICEPERPIECEDOLLAR600EACH010020340URX581949695US to Output file APPLE6S,SAMSUNGS5,PRICEPERPIECE,DOLLAR600EACH,010020340URX581949695,US This is for... (11 Replies)
Discussion started by: m6248m
11 Replies
KEYMOD(1p)						User Contributed Perl Documentation						KEYMOD(1p)

NAME
keymod - Modifies key parameters in a DNSSEC-Tools keyrec file SYNOPSIS
keymod [options] keyrec1 ... keyrecN DESCRIPTION
keymod modifies the key parameters in a keyrec file that are used to generate cryptographics keys used to sign zones. The new parameters will be used by zonesigner when generating new keys. It has no effect on existing keys. zonesigner will use the new parameter for a zone the next time it generates a key that requires that parameter. This means that, for example, a new ZSK length will not be used during the next invocation of zonesigner if that invocation will be performing KSK-rollover actions. The following fields may be modified: kskcount - count of KSK keys ksklength - length of KSK keys ksklife - lifetime of KSK keys random - random number generator device file revperiod - revocation period for KSK keys zskcount - count of ZSK keys zsklength - length of ZSK keys zsklife - lifetime of ZSK keys New key/value fields will be added to a zone keyrec file to inform zonesigner that new values should be used. The key portion of the added fields will begin with "new_". For example, a new KSK length of 2048 will be written to the keyrec file as: new_ksklength 2048 All zone records in the specified keyrec file will be modified, unless the -zone option is given. In that case, only the named zone will be modified. If a zone keyrec already contains a new key/value field, then the value will be modified on subsequent runs of keymod. OPTIONS
keymod recognizes the following options. Multiple options may be combined in a single keymod execution. All numeric values must be positive or zero. If a new key/value field should be deleted from a zone keyrec, then a zero or empty string value should be specified for the appropriate option. -zone zonename The zone keyrec whose name matches zonename is selected as the only keyrec that will be modified. If this name is not given, then all zone keyrec records will be modified. -ksklength ksklength The ksklength field will be modified in the selected keyrec records to the given value. This is a numeric field whose values depend on the cryptographic algorithm to be used to generate keys for the zone. -kskcount kskcount The kskcount field will be modified in the selected keyrec records to the given value. This is a numeric field. -ksklife ksklife The ksklife field will be modified in the selected keyrec records to the given value. This is a numeric field. -random random The random field will be modified in the selected keyrec records to the given value. This is a text field that will be passed to the key generator. -revperiod revperiod The revperiod field will be modified in the selected keyrec records to the given value. This is a numeric field. -zskcount zskcount The zskcount field will be modified in the selected keyrec records to the given value. This is a numeric field. -zsklength zsklength The zsklength field will be modified in the selected keyrec records to the given value. This is a numeric field whose values depend on the cryptographic algorithm to be used to generate keys for the zone. -zsklife zsklife The zsklife field will be modified in the selected keyrec records to the given value. This is a numeric field. -nocheck If this option is given, the krfcheck command will not be run on the modified keyrec file. -verbose Display information about every modification made to the keyrec file. -Version Displays the version information for keymod and the DNSSEC-Tools package. -help Display a usage message. COPYRIGHT
Copyright 2012 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details. AUTHOR
Wayne Morrison, tewok@tislabs.com SEE ALSO
zonesigner(8), krfcheck(8) Net::DNS::SEC::Tools::keyrec.pm(3) file-keyrec(5) perl v5.14.2 2012-06-21 KEYMOD(1p)
All times are GMT -4. The time now is 10:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy