Sponsored Content
Full Discussion: Extracting values from files
Top Forums Shell Programming and Scripting Extracting values from files Post 54435 by Master Error on Friday 13th of August 2004 12:24:30 PM
Old 08-13-2004
Extracting values from files

Im trying to create a utility that can do unit conversions using a seperate formula file(one which i can add conversions to at a later date). however i'm stuck when it comes to pulling the formulas out of the formula file for use in the script.
heres a rundown of what the script does.

The formula file consists of 3 columns :
a code such as m_ft (metres to feet), the constant (used for the conversion), and a description

In the script the user types in the code (m_ft for example), the script then searches for the code in the formula file (using grep).. i opted to send the output from grep into a temp file.
problem is now i want to extract the 2nd column that contains the constant for use in the script. Is there a way to cut the constant and put it into a variable in the script, and then apply an arithmetic operation to it ( y = x * constant) ?

I've looked up piping the cut command but no where does it say if i can pipe to a variable and how the variable will behave.

Tnx
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extracting dynamic values

Hi, I am stuck with extracting values by combining 2 dynamically extracted values. The code goes like this #!/usr/bin/ksh ID1="abcd" i=1 #this is a dynamic value and keeps on changing b="ID" #this is static now i want the value of ID1 variable. like echo $b$i But echo... (1 Reply)
Discussion started by: chaitanyapn
1 Replies

2. Shell Programming and Scripting

Extracting the values separated by comma

Hi, I have a variable which has a list of string separated by comma. for ex , Variable=/usr/bin,/usr/smrshbin,/tmp How can i get the values between the commas separately using shell scripts.Please help me. Thanks, Padmini. (6 Replies)
Discussion started by: padmisri
6 Replies

3. UNIX for Dummies Questions & Answers

Extracting values from an XML file

Hello People, I have an xml file from which I need to extract the values of the parameters using UNIX shell commands. Ex : Input is like : <Name>Roger</Name> or <Address>MI</Address> I need the output as just : Roger or MI with the tags removed. Please help. (1 Reply)
Discussion started by: sushant172
1 Replies

4. Shell Programming and Scripting

extracting values from configuration file

Dear All, i am new to shell scripting, I am working on embedded system based on linux.I am supposed to the read the configuration file and edit another file. presently I would like to read from the configuration file.It would be having values file one below. There is chance of entering... (6 Replies)
Discussion started by: Ratheendran
6 Replies

5. Shell Programming and Scripting

Extracting fetching values

I have a file like this ############################################ # ParentFolder Flag SubFolders Colateral 1 Source1/Checksum CVA 1 Source1/Checksum Test 1 VaR/Checksum Test2 1 SVaR/Checksum FX 1 ... (6 Replies)
Discussion started by: manas_ranjan
6 Replies

6. UNIX for Dummies Questions & Answers

extracting values from file using perl

I would like to read value after $ symbol from a file. For eg a file will be having the following lines. 5,$0,-32768p,32767p,$400014f8,1,, 5,$0,0,0,$400008ce,1,, 5,$0,0,0,$400008d0,1,, i would like to read 400014f8 then 400014f8 and similar all the value after $ symbol.Can any one help... (1 Reply)
Discussion started by: jagadeeshrr
1 Replies

7. Shell Programming and Scripting

Extracting field values from .csv

How can I select the bold fields from the following? "CLLI","SWREL","RPTDATE","RPTIME","TZ","RPTTYPE","RPTPD","IVALDATE","IVALSTART","IVALEND","NUMENTIDS" "tklc9010801","EAGLE5 45.0.0-64.70.1","2013-08-07","02:01:50","MST ","COMPONENT MEASUREMENTS ON... (4 Replies)
Discussion started by: leghorn
4 Replies

8. Shell Programming and Scripting

Extracting values based on line-column numbers from multiple text files

Dear All, I have to solve the following problems with multiple tab-separated text file but I don't know how. Any help would be greatly appreciated. I have access to Linux mint (but not as a professional). I have multiple tab-delimited files with the following structure: file1: 1 44 2 ... (5 Replies)
Discussion started by: Bastami
5 Replies

9. Shell Programming and Scripting

Taking key values from one file and extracting values from another file

Hi, I have two files with values in both. File1: cat 2 3 dog 4 5 elephant 6 7 camel 2 3 File2: ----+--gkf;ajf= ---+---- +----- cat -------=----+ 3 | 4 ----- dog ------++-- 5 | 9 ----++-- elephant | 5 | 7 ---++ camel ------ ++++_---- || 8 | 9 I want the final file as: cat 4... (1 Reply)
Discussion started by: npatwardhan
1 Replies

10. Shell Programming and Scripting

Extracting and comparing values

I was trying to extract value of g1 and p1 only inside the tags where t1 is "Reading C (bytes)" and comparing them to make sure p1 is always less than g1. Here is the Json file I'm using - File:- { "g1" : 1482568, "n1" : "v_4", "p1" : 0, "s1" : "RC", "t1" : "LM", } { "g1" :... (3 Replies)
Discussion started by: Mannu2525
3 Replies
CREATE 
CONVERSION(7) SQL Commands CREATE CONVERSION(7) NAME
CREATE CONVERSION - define a user-defined conversion SYNOPSIS
CREATE [DEFAULT] CONVERSION conversion_name FOR source_encoding TO dest_encoding FROM funcname DESCRIPTION
CREATE CONVERSION defines a new encoding conversion. Conversion names may be used in the CONVERT() function to specify a particular encod- ing conversion. Also, conversions that are marked DEFAULT can be used for automatic encoding conversion between frontend and backend. For this purpose, two conversions, from encoding A to B AND from encoding B to A, must be defined. To be able to create a conversion, you must have the execute right on the function and the create right on the destination schema. "PARAM- ETERS" DEFAULT The DEFAULT clause indicates that this conversion is the default for this particular source to destination encoding. There should be only one default encoding in a schema for the encoding pair. conversion_name The name of the conversion. The conversion name may be schema-qualified. If it is not, the conversion is defined in the current schema. The conversion name must be unique within a schema. source_encoding The source encoding name. source_encoding The destination encoding name. funcname The function used to perform the conversion. The function name may be schema-qualified. If it is not, the function will be looked up in the path. The function must have the following signature: conv_proc( INTEGER, -- source encoding id INTEGER, -- destination encoding id CSTRING, -- source string (null terminated C string) CSTRING, -- destination string (null terminated C string) INTEGER -- source string length ) returns VOID; NOTES
Use DROP CONVERSION to remove user-defined conversions. The privileges required to create a conversion may be changed in a future release. EXAMPLES
To create a conversion from encoding UNICODE to LATIN1 using myfunc: CREATE CONVERSION myconv FOR 'UNICODE' TO 'LATIN1' FROM myfunc; COMPATIBILITY
CREATE CONVERSION is a PostgreSQL extension. There is no CREATE CONVERSION statement in SQL99. SEE ALSO
CREATE FUNCTION [create_function(7)], DROP CONVERSION [drop_conversion(7)], PostgreSQL Programmer's Guide SQL - Language Statements 2002-11-22 CREATE CONVERSION(7)
All times are GMT -4. The time now is 12:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy