Sponsored Content
Top Forums Shell Programming and Scripting Command output to a variable. Post 59294 by videsh77 on Wednesday 15th of December 2004 01:39:39 PM
Old 12-15-2004
Also I would like to get rid of leading zeros, after I read a number from fixed width
file.
Say, 00000015 should be read as 15.

How would I achieve that?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Assigning output of command to a variable

Hi, I'm trying to assign the output of a command to a variable and then concat it with another string, however, it keeps overwriting the original string instead of adding on to the end of the string. Contents of test.txt --> This is a test var1="`head -n 1 test.txt`" echo $var1 (This is a... (5 Replies)
Discussion started by: oma04
5 Replies

2. UNIX for Dummies Questions & Answers

ls command output to variable in script

Hi, I wrote a script to get the oldest file from a directory path (which is passed as a parameter to the script) ######################################################### XMLFILE_PATH={$1} cd $XMLFILE_PATH JPM_FILENAME = `(ls -tr User* | head -1)` #echo $JPM_FILENAME ###### END... (1 Reply)
Discussion started by: dsrookie
1 Replies

3. Shell Programming and Scripting

get characters from output of a command in a variable

Hi, i have two questions, I am new to programming 1. I have an output of a command and i want to get some specific part of it in a variable. i am trying sr=`some comand xyz| grep 'Last Changed Rev:' | cut -c19-` now variable sr gets a end of line character at end. output of the command... (3 Replies)
Discussion started by: muaz
3 Replies

4. Shell Programming and Scripting

Assigning output of a command to variable

When I run time -p <command>, it outputs: real X.XX user X.XX sys X.XXwhere X.XX is seconds. How I can take just that first number output, the seconds of real time, and assign that to a variable? (9 Replies)
Discussion started by: jeriryan87
9 Replies

5. UNIX for Dummies Questions & Answers

saving command output to a variable

Hello, I have a shell script containing a command string in the following format: command1 | command2 | cut -c9-16 The output from this is a record number (using characters 9-16 of the original output string) e.g. ORD-1234 I wish to save this value to a variable for use in later commands... (4 Replies)
Discussion started by: philjo
4 Replies

6. Programming

Command output into a variable

Hi, with this command: cu -l /dev/ttyACM0 -s 9600 > name.txt I put the output of the port in a txt Is posible to do the same (or similar) in a var directly, inside a C program? cu -l /dev/ttyACM0 -s 9600 > variable ? I have trying this withs pipes, but i dont know how to... (6 Replies)
Discussion started by: daaran
6 Replies

7. Shell Programming and Scripting

set variable to command output

I'm hoping you guys can help me out here. I've been trying different methods to try and get what IW as hoping would be a fairly simple script but has turned into a pain. Bit of background - I am writing a script to check values in certain failes to ensure they are corerct. I'm runnign this on... (2 Replies)
Discussion started by: stuc
2 Replies

8. UNIX for Advanced & Expert Users

ls output into a read command as a variable

I'm working on a short BASH script on my Ubuntu box that will run powerpoint scripts with MS Powerpoint Viewer 2007 via WINE. I can run the presentation when I run it manually but what i'd like to do is have the script look for the newest file then run it. #! /bin/sh # Start the newest... (2 Replies)
Discussion started by: binary-ninja
2 Replies

9. Shell Programming and Scripting

Output of find command to variable?

Hi, I'd like to assign the output of the find command to a variable. What I need is to run the find command, and if it returns zero files, the program exits. so i'm trying to assign the output of the find command to the $var1 variable....and then if this is less than one, I echo a... (2 Replies)
Discussion started by: horhif
2 Replies

10. Shell Programming and Scripting

How to get the output of a ISQL command in a variable?

I am trying to run a query which returns a sum value(a number). I want to get it in a variable so that i can refer to that variable in different places. when i am running the following command variable=`isql -Uuser -Sserver -Ppassword 1> select sum(count(*)) from xyz..abc where clm_id... (2 Replies)
Discussion started by: Sharma331
2 Replies
fixed(3erl)						     Erlang Module Definition						       fixed(3erl)

NAME
fixed - the corba fixed type DESCRIPTION
This module contains functions that gives an interface to the CORBA fixed type. The type Fixed used below is defined as: -record(fixed, {digits, scale, value}). where digits is the total amount of digits it consists of and scale is the number of fractional digits. The value field contains the actual Fixed value represented as an integer. The limitations of each field are: * Digits - integer(), -1 > Digits < 32 * Scale - integer(), -1 > Scale =< Digits * Value - integer(), range (31 digits): +/-9999999999999999999999999999999 Since the Value part is represented by an integer, it is vital that the Digits and Scale values are correct. This also means that trailing zeros cannot be left out in some cases: * fixed<5,3> eq. 03.140d eq. 3140 * fixed<3,2> eq. 3.14d eq. 314 Leading zeros can be left out. For your convenience, this module exports functions which handle unary ( - ) and binary ( +-*/ ) operations legal for the Fixed type. Since a unary + have no effect, this module do not export such a function. Any of the binary operations may cause an overflow (i.e. more than 31 significant digits; leading and trailing zeros are not considered significant). If this is the case, the Digit and Scale values are adjusted and the Value truncated (no rounding performed). This behavior is compliant with the OMG CORBA specification. Each binary opera- tion have the following upper bounds: * Fixed1 + Fixed2 - fixed<max(d1-s1,d2-s2) + max(s1,s2) + 1, max(s1,s2)> * Fixed1 - Fixed2 - fixed<max(d1-s1,d2-s2) + max(s1,s2) + 1, max(s1,s2)> * Fixed1 * Fixed2 - fixed<d1+d2, s1+s2> * Fixed1 / Fixed2 - fixed<(d1-s1+s2) + Sinf ,Sinf > A quotient may have an arbitrary number of decimal places, which is denoted by a scale of Sinf. EXPORTS
create(Digits, Scale, Value) -> Result Types Result = Fixed Type | {'EXCEPTION', #'BAD_PARAM'{}} This function creates a new instance of a Fixed Type . If the limitations is not fulfilled (e.g. overflow) an exception is raised. get_typecode(Fixed) -> Result Types Result = TypeCode | {'EXCEPTION', #'BAD_PARAM'{}} Returns the TypeCode which represents the supplied Fixed type. If the parameter is not of the correct type, an exception is raised. add(Fixed1, Fixed2) -> Result Types Result = Fixed1 + Fixed2 | {'EXCEPTION', #'BAD_PARAM'{}} Performs a Fixed type addition. If the parameters are not of the correct type, an exception is raised. subtract(Fixed1, Fixed2) -> Result Types Result = Fixed1 - Fixed2 | {'EXCEPTION', #'BAD_PARAM'{}} Performs a Fixed type subtraction. If the parameters are not of the correct type, an exception is raised. multiply(Fixed1, Fixed2) -> Result Types Result = Fixed1 * Fixed2 | {'EXCEPTION', #'BAD_PARAM'{}} Performs a Fixed type multiplication. If the parameters are not of the correct type, an exception is raised. divide(Fixed1, Fixed2) -> Result Types Result = Fixed1 / Fixed2 | {'EXCEPTION', #'BAD_PARAM'{}} Performs a Fixed type division. If the parameters are not of the correct type, an exception is raised. unary_minus(Fixed) -> Result Types Result = -Fixed | {'EXCEPTION', #'BAD_PARAM'{}} Negates the supplied Fixed type. If the parameter is not of the correct type, an exception is raised. Ericsson AB orber 3.6.20 fixed(3erl)
All times are GMT -4. The time now is 08:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy