Sponsored Content
Full Discussion: Modifications to a file
Top Forums Shell Programming and Scripting Modifications to a file Post 302632917 by kristinu on Tuesday 1st of May 2012 06:25:07 AM
Old 05-01-2012
Modifications to a file

I have a file whose format is shown below. It has a table of numbers. In this case, I have 16 values in 12 rows.

I want to select a position in the table, example, the 5th number at row 5. I need to change the value in that position by a certain amount and output the file with the modifiation.

Code:
% XI=(0,-0.5)
% XF=(80,30)

%< LAYER 1

% INTI=LIN
%( INTERFACE
0 0
80 0
%)

% PS=OFF

% INTP=LIN
%( MODELP
0.539195 0.499185 0.44318 0.420795 0.428972 0.407489 0.416661 0.396913 0.396623 0.406523 0.414327 0.4175 0.421689 0.439757 0.532754 0.639871 
0.958519 0.949427 0.91807 0.909091 0.921724 0.853104 0.809542 0.826688 0.818666 0.818959 0.850298 0.927109 0.91142 0.895533 0.963707 1.0135 
1.39397 1.36207 1.31659 1.35339 1.3523 1.2593 1.2001 1.21804 1.20746 1.19825 1.26995 1.35578 1.35353 1.3436 1.35959 1.3617 
1.83863 1.79101 1.75435 1.78663 1.82813 1.76773 1.68538 1.67378 1.66626 1.67004 1.7663 1.82656 1.83235 1.82628 1.78751 1.78362 
2.2295 2.225 2.19439 2.25352 2.28417 2.28628 2.20701 2.20558 2.19025 2.21139 2.25812 2.26599 2.28262 2.26116 2.25146 2.21499 
2.62044 2.63175 2.58642 2.61448 2.66013 2.62454 2.63246 2.61672 2.60205 2.59614 2.62228 2.63382 2.64696 2.66988 2.6161 2.56025 
2.99931 2.95359 2.92076 2.89449 2.90146 2.9228 2.95267 2.94976 2.94918 2.94359 2.98141 2.98476 2.98086 2.97434 2.89634 2.89142 
3.34278 3.2937 3.21962 3.20083 3.17678 3.22456 3.26254 3.27324 3.26747 3.27395 3.2762 3.29426 3.2832 3.24564 3.22182 3.18713 
3.58525 3.56012 3.51039 3.51268 3.48492 3.49081 3.49647 3.51275 3.53483 3.52009 3.51921 3.53977 3.53447 3.51355 3.5001 3.45128 
3.82946 3.8293 3.77809 3.78202 3.77015 3.77801 3.74097 3.74021 3.77757 3.80818 3.79032 3.75711 3.78332 3.77289 3.7477 3.73956 
4.13013 4.07422 4.04127 4.03045 4.02955 4.00759 3.98444 3.98823 4.00529 4.02987 4.03192 3.99721 3.99899 3.98829 3.9902 3.99331 
4.38031 4.3538 4.32092 4.29449 4.31182 4.26834 4.20803 4.20388 4.23141 4.26625 4.25487 4.24072 4.23403 4.2237 4.23338 4.22982 
%)

%>

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

In Line File Modifications: Search and Replace

grep -il "TEST" ${ENVIRON}/*.pde| while read pde &nbsp;&nbsp;do &nbsp;&nbsp;&nbsp;&nbsp;cat $pde | sed s/"TEST 3,1"/"TEST 3,0"/g | sed s/"TEST&nbsp;&nbsp;3,1"/"TEST&nbsp;&nbsp;3,0"/g > ${pde}.tmp &nbsp;&nbsp;&nbsp;&nbsp;if ; then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mv ${pde}.tmp $pde ... (2 Replies)
Discussion started by: Shakey21
2 Replies

2. UNIX for Advanced & Expert Users

Tracing file modifications

Hello all! Is there a way or a utility to trace any kind of file changes in a particular directory on any UNIX machine? The purpose is that in Unix, there are multiple ways of opening and making changes to a file. But internally, there must be something common (a single pipe, etc.) that is... (3 Replies)
Discussion started by: gupta_ca
3 Replies

3. UNIX for Dummies Questions & Answers

list files with modifications <15 minutes

Good Afternoon Guys: we can use ls -l to find out the files and their modification time. however, how to list the files say which are modified 15 minutes before. we have find command which uses -mtime and -atime for modification and access timing. However, if we just be restricted to the current... (2 Replies)
Discussion started by: tom_k_mishra
2 Replies

4. Shell Programming and Scripting

my shell script (file modifications)

hi guys Need some help on my below script #!/bin/sh if then echo "~~:S:wait:/sbin/sulogin" >> /root/joy/inittab else echo "/root/joy/inittab does not exist" fi now the problem is that when i run the above script it runs successfully but when i run it repeatedly the word echo... (2 Replies)
Discussion started by: whizkidash
2 Replies

5. Shell Programming and Scripting

question about testing in shell programming(modifications were made)

In folder A i have a file "a' and text file named infile00.I would like to do redirection :a<infile01. There is a code to do this #get a file "a" in /home/A for file in /home/A/* do if $file ] then #printing out if file is an execute file echo $file "is an... (2 Replies)
Discussion started by: thungmail
2 Replies

6. Shell Programming and Scripting

how to write modifications in to two tables

hi, how to write modifictions of two tables in the ksh (0 Replies)
Discussion started by: naveeng.81
0 Replies

7. Shell Programming and Scripting

XML file modifications using sed

Hi, During an installation process in a bash script I need to do 2 things with 2 XML files. Does the use of sed affect in any way the XML file ? 1.Add to a section in <ServerListeners> section <ServerListener> <BaseClass>myapp.module.WowConfigurator</BaseClass> </ServerListener> The... (2 Replies)
Discussion started by: potro
2 Replies

8. Shell Programming and Scripting

Modifications to a file

Hi, I do not have a clue how to do this nor can I find information on it but I have a file that looks like this (basically 3 columns and tab delimited). I need this in a particular format in order for a program to actually read it. chr1 2 4 chr1 2 5 chr1 3 6 chr2 1 4 chr2 2 5 ... (2 Replies)
Discussion started by: kylle345
2 Replies

9. Shell Programming and Scripting

Modifications using Lookup file

I have 2 files. File 1 delimited by ";" File 1: 001;0;11223;xx;N;1001051;124;1;1;1001051;110;0;A_15;D;DX;U 001;0;8830943;xx;P;1226040;978;1;0;1226040;110;0;A_15;D;DX;H 001;0;10946903;xx;N;1300496;978;1;1;1300496;110;0;A_17;D;DX;H... (2 Replies)
Discussion started by: pparthiv
2 Replies

10. Shell Programming and Scripting

Sentence delimiter in perl: modifications needed

Hello, I found this Perl Script on the EuroParl website which does Sentence Splitting. #!/usr/bin/perl -w # Based on Preprocessor written by Philipp Koehn binmode(STDIN, ":utf8"); binmode(STDOUT, ":utf8"); binmode(STDERR, ":utf8"); use FindBin qw($Bin); use strict; my $mydir =... (0 Replies)
Discussion started by: gimley
0 Replies
DB2_STATISTICS(3)							 1							 DB2_STATISTICS(3)

db2_statistics - Returns a result set listing the index and statistics for a table

SYNOPSIS
resource db2_statistics (resource $connection, string $qualifier, string $schema, string $table-name, bool $unique) DESCRIPTION
Returns a result set listing the index and statistics for a table. PARAMETERS
o $connection - A valid connection to an IBM DB2, Cloudscape, or Apache Derby database. o $qualifier - A qualifier for DB2 databases running on OS/390 or z/OS servers. For other databases, pass NULL or an empty string. o $schema - The schema that contains the targeted table. If this parameter is NULL, the statistics and indexes are returned for the schema of the current user. o $table_name - The name of the table. o $unique - An integer value representing the type of index information to return. o $0 - Return only the information for unique indexes on the table. o $1 - Return the information for all indexes on the table. RETURN VALUES
Returns a statement resource with a result set containing rows describing the statistics and indexes for the base tables matching the specified parameters. The rows are composed of the following columns: +--------------+---------------------------------------------------+ | Column name | | | | | | | Description | | | | +--------------+---------------------------------------------------+ | TABLE_CAT | | | | | | | The catalog that contains the table. The value is | | | NULL if this table does not have catalogs. | | | | | TABLE_SCHEM | | | | | | | Name of the schema that contains the table. | | | | | TABLE_NAME | | | | | | | Name of the table. | | | | | NON_UNIQUE | | | | | | | An integer value representing whether the index | | | prohibits unique values, or whether the row rep- | | | resents statistics on the table itself: | | | | | | box, tab (|); c | c | . T{ Return value | | | | | | Parameter type | | | | +--------------+---------------------------------------------------+ |0 (SQL_FALSE) | | | | | | | The index allows duplicate values. | | | | |1 (SQL_TRUE) | | | | | | | The index values must be unique. | | | | | | | | NULL | | | | | | | This row is statistics information for the table | | | itself. | | | | +--------------+---------------------------------------------------+ T} T{ INDEX_QUALIFIER T} |T{ A string value representing the qualifier that would have to be prepended to INDEX_NAME to fully qualify the index. T} T{ INDEX_NAME T} |T{ A string representing the name of the index. T} T{ TYPE T} |T{ An integer value representing the type of information contained in this row of the result set: +------------------------+---------------------------------------------------+ | Return value | | | | | | | Parameter type | | | | +------------------------+---------------------------------------------------+ | 0 (SQL_TABLE_STAT) | | | | | | | The row contains statistics about the table | | | itself. | | | | |1 (SQL_INDEX_CLUSTERED) | | | | | | | The row contains information about a clustered | | | index. | | | | | 2 (SQL_INDEX_HASH) | | | | | | | The row contains information about a hashed | | | index. | | | | | 3 (SQL_INDEX_OTHER) | | | | | | | The row contains information about a type of | | | index that is neither clustered nor hashed. | | | | +------------------------+---------------------------------------------------+ T} T{ ORDINAL_POSITION T} |T{ The 1-indexed position of the column in the index. NULL if the row contains statistics information about the table itself. T} T{ COLUMN_NAME T} |T{ The name of the column in the index. NULL if the row contains statistics information about the table itself. T} T{ ASC_OR_DESC T} |T{ A if the column is sorted in ascending order, D if the column is sorted in descending order, NULL if the row contains statistics informa- tion about the table itself. T} T{ CARDINALITY T} |T{ If the row contains information about an index, this column contains an integer value representing the number of unique values in the index. If the row contains information about the table itself, this column contains an integer value representing the number of rows in the table. T} T{ PAGES T} |T{ If the row contains information about an index, this column contains an integer value representing the number of pages used to store the index. If the row contains information about the table itself, this column contains an integer value representing the number of pages used to store the table. T} T{ FILTER_CONDITION T} |T{ Always returns NULL. T} SEE ALSO
db2_column_privileges(3), db2_columns(3), db2_foreign_keys(3), db2_primary_keys(3), db2_procedure_columns(3), db2_procedures(3), db2_spe- cial_columns(3), db2_table_privileges(3), db2_tables(3). PHP Documentation Group DB2_STATISTICS(3)
All times are GMT -4. The time now is 06:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy