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
NAMAZU(1)							  Namazu Project							 NAMAZU(1)

NAME
namazu - a search program of Namazu SYNOPSIS
namazu [options] <query> [index]... DESCRIPTION
namazu 2.0.9, a search program of Namazu. -n, --max=NUM set number of documents shown to NUM. -w, --whence=NUM set first number of documents shown to NUM. -l, --list print results by listing format. -s, --short print results by short format. --result=EXT set NMZ.result.EXT for printing results. --late sort documents in late order. --early sort documents in early order. --sort=METHOD set a sort METHOD (score, date, field:name) --ascending sort in ascending order (default: descending) -a, --all print all results. -c, --count print only number of hits. -h, --html print in HTML format. -r, --no-references do not display reference hit counts. -H, --page print further result links. (nearly meaningless) -F, --form force to print <form> ... </form> region. -R, --no-replace do not replace URI string. -U, --no-decode-uri do not decode URI when printing in a plain format. -o, --output=FILE set the output file name to FILE. -f, --config=FILE set the config file name to FILE. -C, --show-config print current configuration. -q, --quiet do not display extra messages except search results. -d, --debug be debug mode. -v, --version show the version of namazu and exit. --help show this help and exit REPORTING BUGS
Report bugs to <bug-namazu@namazu.org>. COPYRIGHT
Copyright (C) 1997-1999 Satoru Takabayashi All rights reserved. Copyright (C) 2000,2001 Namazu Project All rights reserved. This is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. namazu of Namazu 2.0.9 November 2001 NAMAZU(1)
All times are GMT -4. The time now is 05:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy