Sponsored Content
Top Forums Shell Programming and Scripting Sed replace characters not equal to an expression Post 302350200 by poldo on Thursday 3rd of September 2009 04:57:08 AM
Old 09-03-2009
Computer Sed replace characters not equal to an expression

Hi all,

Suppose I have a file with the contents below, and I only want to print words %S_[A-Z] then | sort -u.


------------------------------
The %S_MSG that starts with '%.*s' is too long. Maximum length is %d.
The %S_MSG name '%.*s' contains more than the maximum number of prefixes. The maximum is %d.
The size (%d) given to the %S_MSG '%.*s' exceeds the maximum. The largest size allowed is %d.
%S_MSG is not allowed in %S_MSG.
The %S_MSG '%.*s' is out of the range of machine representation (%d bytes).
'%.*s' is not a recognized %S_MSG.
%s permission denied on object %S_OBJID, database %S_DBID, owner %.*s
%s permission denied on column %.*s of object %S_OBJID, database %S_DBID, owner %.*s
The column %.*s in table %.*s does not allow null values.%S_EED
Precision error during %S_MSG conversion of %s value '%s' to a %s field.
Scale error during %S_MSG conversion of %s value '%s' to a %s field.
Domain error during %S_MSG conversion of %s value '%s' to a %s field.
Arithmetic overflow during %S_MSG conversion of %s value '%s' to a %s field .
Syntax error during %S_MSG conversion of %s value '%s' to a %s field.
%s permission denied, database %S_DBID, owner %.*s
------------------------------------------

I'm trying to get the output like below
%S_MSG
%S_DBID
...
...

Problem is i don't know how many characters there are after the %S_, only that these are all caps.

I'm kind of new here also and any help is appreciated. I usually go here to look for help and tips in scripting. Smilie

Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to replace control characters using sed?

How can I use sed to replace a ctrl character such as 'new line' (\0a) to something else? Or any other good command can do this job? Thanks, Hillxy (5 Replies)
Discussion started by: hillxy
5 Replies

2. UNIX for Dummies Questions & Answers

replace words in sed using regular expression

hi, I need to replace all these lines from my text file 123end 234end 324end 234end 989end 258end 924end At the moment I know how to replace "end". But I want to replace the numbers before end as well. How can I do this ? sed s/end/newWord/ myfile.txt newFile.txt thanks (3 Replies)
Discussion started by: aneuryzma
3 Replies

3. Shell Programming and Scripting

Using sed to replace special characters

Hi everyone I have file1 contains: '7832' ' 8765 6543 I want a sed command that will format as: '7832' , '8765' , '6543' I tried sed -e s/\'//g -e 's/^*//;s/*$//' file1 > file2 sed -e :a -e '$!N; s/\n/ /; ta' file2 which gives: 7832 8765 6543 I need some help to continue with... (5 Replies)
Discussion started by: nimo
5 Replies

4. Shell Programming and Scripting

sed to replace the matching pattern with equal number of spaces

Hi I have written a shell script which used sed code below sed -i 's/'"$Pattern"'/ /g' $FileName I want to count the length of Pattern and replace it with equal number of spaces in the FileName. I have used $(#pattern) to get the length but could not understand how to replace... (8 Replies)
Discussion started by: rakeshkumar
8 Replies

5. Shell Programming and Scripting

Sed: -e expression #1, char 2: extra characters after command

Greetings.. getting the error while execution of the script, correct where i am missing #!/bin/bash DATE=`date +%Y-%m-%d:::%H:%M` HOSTNAME=`hostname` TXT="/log/temp.txt" LOGPATH="/log1/commanlogs/" IP=`/sbin/ifconfig | grep -i inet| head -n1| awk '{print $2}'| awk -F : '{print $2}'`... (7 Replies)
Discussion started by: manju98458
7 Replies

6. Shell Programming and Scripting

How does this sed expression to remove non-alpha characters work?

Hello! I know that this expression gets rid of non-alphanumeric characters: sed 's///g' and I understand that it is replacing them with nothing - hence the '//'-, but I don't understand how it's doing it. It seems it's finding strings that begin with alphanumeric and replacing them with... (2 Replies)
Discussion started by: bgnersoon2be#1
2 Replies

7. Shell Programming and Scripting

sed - How to replace right part of equal sign (=) on a line

Hello. Using a bash script , I have a variable name for the file I want to modify FILE_TO_EDIT="/etc/my_config_file"And I have a variable name for the parameter to change PARAMETER="fallback_node" PARAMETER_NEW_VALUE="http://my_server_name.com/new_path" A config file may contain : 1°)... (2 Replies)
Discussion started by: jcdole
2 Replies

8. Shell Programming and Scripting

Replace characters infile with sed

I have several files in a directory that look like this: jacket-n r potential-n - outcome-n f reputation-n b I want to replace the characters in the second column with certain numbers. For instance, I want the letters 'f', 'r' and 'b' in the second column to replaced with 0 and I want the... (1 Reply)
Discussion started by: owwow14
1 Replies

9. Shell Programming and Scripting

How to replace all but the first 3 characters with sed?

This seems like it should be an easy problem, but for some reason I am struggling with the solution. I simply want to replace all characters after the first 3 characters with another character, preferably with sed. Thanks in advance. Like this, but producing the proper number of *'s: sed... (30 Replies)
Discussion started by: leolson
30 Replies

10. Shell Programming and Scripting

sed replace characters using a wildcard

Hello, I have some data that looks like the following, > <SALTDATA> (OVS0199262) HCl > <IDNUMBER> (OVS0199262) OVS0199262 > <SUPPLIER> (OVS0199262) TimTec > <EMAIL> (OVS0199262) info@timtec.net > <WEBSITE> (OVS0199262) http://www.timtec.net I need to remove the data in... (3 Replies)
Discussion started by: LMHmedchem
3 Replies
MPI_Alloc_mem(3OpenMPI) 												   MPI_Alloc_mem(3OpenMPI)

NAME
MPI_Alloc_mem - Allocates a specified memory segment. SYNTAX
C Syntax #include <mpi.h> int MPI_Alloc_mem(MPI_Aint size, MPI_Info info, void *baseptr) Fortran Syntax (see FORTRAN NOTES) INCLUDE 'mpif.h' MPI_ALLOC_MEM(SIZE, INFO, BASEPTR, IERROR) INTEGER INFO, IERROR INTEGER(KIND=MPI_ADDRESS_KIND) SIZE, BASEPTR C++ Syntax #include <mpi.h> void* MPI::Alloc_mem(MPI::Aint size, const MPI::Info& info) INPUT PARAMETERS
size Size of memory segment in bytes (nonnegative integer). info Info argument (handle). OUTPUT PARAMETERS
baseptr Pointer to beginning of memory segment allocated. IERROR Fortran only: Error status (integer). DESCRIPTION
MPI_Alloc_mem allocates size bytes of memory. The starting address of this memory is returned in the variable base. FORTRAN NOTES
There is no portable FORTRAN 77 syntax for using MPI_Alloc_mem. There is no portable Fortran syntax for using pointers returned from MPI_Alloc_mem. However, MPI_Alloc_mem can be used with Sun Fortran compilers. From FORTRAN 77, you can use the following non-standard declarations for the SIZE and BASEPTR arguments: INCLUDE "mpif.h" INTEGER*MPI_ADDRESS_KIND SIZE, BASEPTR From either FORTRAN 77 or Fortran 90, you can use "Cray pointers" for the BASEPTR argument. Cray pointers are described further in the For- tran User's Guide and are supported by many Fortran compilers. For example, INCLUDE "mpif.h" REAL*4 A(100,100) POINTER (BASEPTR, A) INTEGER*MPI_ADDRESS_KIND SIZE SIZE = 4 * 100 * 100 CALL MPI_ALLOC_MEM(SIZE,MPI_INFO_NULL,BASEPTR,IERR) ! use A CALL MPI_FREE_MEM(A, IERR) 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. By default, this error handler aborts the MPI job, except for I/O function errors. The error handler may be changed with MPI_Comm_set_errhandler; the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error. SEE ALSO
MPI_Free_mem Open MPI 1.2 September 2006 MPI_Alloc_mem(3OpenMPI)
All times are GMT -4. The time now is 03:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy