Sponsored Content
Full Discussion: Getting values from a string
Top Forums Programming Getting values from a string Post 302724359 by kristinu on Thursday 1st of November 2012 06:56:37 AM
Old 11-01-2012
Getting values from a string

I have a string

Code:
s = " 1.0007126 6.8643880e+05 3.2924832e-09 9.4557639e+02  1.6407053 4.3481956e+03"

The numbers are separated by spaces and I want to get the first two numbers.

I am programming in Fortran, however a solution in c might be ok.

---------- Post updated 11-01-12 at 05:56 AM ---------- Previous update was 10-31-12 at 01:18 PM ----------

Done now
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

to separate values from a string

Hi I would like to take input from user like username/password@connectstring I should be able to cut the username and password and connect string for example if someone enters like sam/sammy@ora1 my program should take sam as username sammy as password and ora1 as connectstring and... (3 Replies)
Discussion started by: ssuresh1999
3 Replies

2. Shell Programming and Scripting

Append values before a string

hi all, i have variables a and b with values, like a="/var/tmp/new.sh /var/tmp/new2.sh" b="/TEST" how i need to append the value "/TEST" before the values for the variable "a" so that i get the output as /TEST/var/tmp/new.sh /TEST/var/tmp/new2.sh plz help me Regards, NG (2 Replies)
Discussion started by: Nandagopal
2 Replies

3. Shell Programming and Scripting

Replace blank values for string using sed

Hi everyone, I was wondering how could from a file where each row is separated by tabulations, the row values where are in blank replace them by a string or value. My file has this form: 26/01/09 13:45:00 0 0 26/01/09 14:00:00 1495.601318 0 26/01/09 14:15:00 1495.601318 0 ... (4 Replies)
Discussion started by: tonet
4 Replies

4. Shell Programming and Scripting

Matching multiple values in a string

I've been battling with parsing a comma-delimited string, and have had what I would call B- success. I'm using perl and trying to parse out specific identifiers from a string, into a new string. When things are "normal," my regex works fine. When things get complicated, my script fails... (1 Reply)
Discussion started by: linber2880
1 Replies

5. AIX

How to append spaces to string values?

i/o file: abc,efg,xyz Required o/p file: "abc (Value + blank spaces=16) " ,"efg (Value +blank spaces=15) " ,"xyz (Value+ blank spaces =20) " In short input file value stores in result file with " i/p Value " added with spaces and are of fixed size like 16,15,20 How to do using... (2 Replies)
Discussion started by: AhmedLakadkutta
2 Replies

6. Shell Programming and Scripting

Replacing string values from a File

I want to replace string values from a file to a file For eg : File1 has 30 lines of string with values, those specific values needs to be changed in file2 and remaining values in file2 should be as it is. For example: From file (File1) cluster.name=secondaryCluster To replace File... (9 Replies)
Discussion started by: sriram003
9 Replies

7. UNIX for Dummies Questions & Answers

How to append values to a string?

Hi, Requesting some help with a problem I am facing with string function in UNIX. I wish to create 2 string variables: 1st header string containing output_1, output_2, .. , output_<n> and 2nd data string containing the filename separated by colon (":") and corresponding filesize separated by... (6 Replies)
Discussion started by: vkumbhakarna
6 Replies

8. UNIX for Dummies Questions & Answers

awk - How to join the string with values

Hi, I'm a beginner in awk script. I've been trying to figure how to concatenate two string in input file using awk after the value is calculated. I'm trying to get this format Apple 5.2(10) Orange 4.4(8) Watermelon 3.10(30) Berries 10.2(20) The input file with the format fruit... (2 Replies)
Discussion started by: KCApple
2 Replies

9. Shell Programming and Scripting

Cutting string values from a file

My file looks like this.... User:SYSTEM,O/S User:oracle,Process:3408086,Machine:hostname ,Program:sqlplus@hostname (TNS V1-V,Logon Time:25-JUL-20 14 13:36 I want to get the date and time which is displayed after the 'Logon time'. (5 Replies)
Discussion started by: Nagesh_1985
5 Replies

10. UNIX for Beginners Questions & Answers

To Fetch values from String

Dears, I have string like below in my csv file <someTechnicalDetails><someTechnicalDetails>HSI</someTechnicalDetails,1234564 <someTechnicalDetails><someTechnicalDetails>Voice</someTechnicalDeta,12345673 <someTechnicalDetails><someTechnicalDetails>IPTV</someTechnicalDetai,12345673 and I... (2 Replies)
Discussion started by: mirwasim
2 Replies
MPI_File_preallocate(3OpenMPI)											    MPI_File_preallocate(3OpenMPI)

NAME
MPI_File_preallocate - Preallocates a specified amount of storage space at the beginning of a file (collective). SYNTAX
C Syntax #include <mpi.h> int MPI_File_preallocate(MPI_File fh, MPI_Offset size) Fortran Syntax (see FORTRAN 77 NOTES) INCLUDE 'mpif.h' MPI_FILE_PREALLOCATE(FH, SIZE, IERROR) INTEGER FH, IERROR INTEGER(KIND=MPI_OFFSET_KIND) SIZE C++ Syntax #include <mpi.h> void MPI::File::Preallocate(MPI::Offset size) INPUT
/OUTPUT PARAMETER fh File handle (handle). INPUT PARAMETER
size Size to preallocate file, in bytes (integer). OUTPUT PARAMETER
IERROR Fortran only: Error status (integer). DESCRIPTION
MPI_File_preallocate ensures that storage space is allocated for the first size bytes of the file associated with fh. MPI_File_preallocate can be a very time-consuming operation. MPI_File_preallocate is collective; all processes in the group must pass identical values for size. Regions of the file that have previ- ously been written are unaffected. For newly allocated regions of the file, MPI_File_preallocate has the same effect as writing undefined data. If size is larger than the current file size, the file size increases to size. If size is less than or equal to the current file size, the file size is unchanged. The treatment of file pointers, pending nonblocking accesses, and file consistency is the same as with MPI_File_set_size. If MPI_MODE_SEQUENTIAL mode was specified when the file was opened, it is erroneous to call this routine. FORTRAN 77 NOTES The MPI standard prescribes portable Fortran syntax for the SIZE argument only for Fortran 90. FORTRAN 77 users may use the non-portable syntax INTEGER*MPI_OFFSET_KIND SIZE where MPI_OFFSET_KIND is a constant defined in mpif.h and gives the length of the declared integer in bytes. NOTES
When using the collective routine MPI_File_set_size on a UNIX file, if the size that is set is smaller than the current file size, the file is truncated at the position defined by size. If the size is set to be larger than the current file size, the file size becomes the set size. When the file size is increased this way with MPI_File_set_size, new regions are created in the file with displacements between the old file size and the larger, newly set file size. Sun MPI I/O does not necessarily allocate file space for such new regions. You may reserve file space either by using MPI_File_preallocate or by performing a read or write to certain bytes. ERRORS
Almost all MPI routines return an error value; C routines as the value of the function and Fortran routines in the last argument. C++ func- tions do not return errors. If the default error handler is set to MPI::ERRORS_THROW_EXCEPTIONS, then on error the C++ exception mechanism will be used to throw an MPI:Exception object. Before the error value is returned, the current MPI error handler is called. For MPI I/O function errors, the default error handler is set to MPI_ERRORS_RETURN. The error handler may be changed with MPI_File_set_errhandler; the predefined error handler MPI_ERRORS_ARE_FATAL may be used to make I/O errors fatal. Note that MPI does not guarantee that an MPI program can continue past an error. Open MPI 1.2 September 2006 MPI_File_preallocate(3OpenMPI)
All times are GMT -4. The time now is 10:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy