03-08-2011
Try sed 's#weirdchar1#&entity1;#g; s#weirdchar2#&entity2;#g;' < input You can add as many patters as you like, stringing them together with ;
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
In a file, How do I replace a set number of characters in each line?
For example.... substitute the first 54 characters of each line with mv?
Thanks!
Lisa (8 Replies)
Discussion started by: lgardner17325
8 Replies
2. Shell Programming and Scripting
Hi
I have searched for a way to replace odd characters in a FOLDER NAME. All search-and-replace issues I have seen, only involves how to make search-and-replace on a FILE och with TEXT INSIDE a FILE. My problem is with the FOLDER NAME.
My case is this:
I have a couple of persons that every... (5 Replies)
Discussion started by: arndorff
5 Replies
3. Shell Programming and Scripting
Hi,
I try to get tr to replace multibytes characters by ascii equivalent. For example
"Je vais ŕ l'école" ---> 'Je vais a l'ecole"
But my version of tr (5.97) doesn't seem to support multibyte sets.
$ locale charmap; echo "Je vais ŕ l'école" | tr éŕ ea
UTF-8
Je vais aa l'aacole
I try to... (2 Replies)
Discussion started by: ripat
2 Replies
4. Shell Programming and Scripting
Hi,
I have a file in which i want to replace the charaters from position 3-5 with a particular string for the first line.
For ex
The file contains
abcdefghij
jkdsflsfkdk
908090900
i want to replace the characters 3-5 for the first line as 678
so, the file should look like
... (7 Replies)
Discussion started by: dnat
7 Replies
5. Shell Programming and Scripting
I've got a file (numbers.txt) filled with numbers and I want to replace each one of those numbers with a new random number between 0 and 9. This is my script so far:
#!/bin/bash
rand=$(($RANDOM % 9))
sed -i s//$rand/g numbers.txtThe problem that I have is that it replaces each number with just... (2 Replies)
Discussion started by: hellocatfood
2 Replies
6. Solaris
Hi ,
I want to replace the special characters in the file.
For eg: cat abc
1234/4455/acb
234/k/lll/
234`fs`fd
I want to replace / and ` with the letter a and the output should like below. How to achieve this.
1234a4455aacb
234akallla
234afsafd (2 Replies)
Discussion started by: rogerben
2 Replies
7. Shell Programming and Scripting
I have a line ending with special character and 0
The special character is the field separator for this line
in VI mode the file will look like below, but while cat the special character wont display
i know the hexa code for the special character ^_ is \x1f and ascii code is
\0037,
... (0 Replies)
Discussion started by: ratheeshjulk
0 Replies
8. Shell Programming and Scripting
i need to replace the any special characters with escape characters like below.
test!=123-> test\!\=123
!@#$%^&*()-= to be replaced by
\!\@\#\$\%\^\&\*\(\)\-\= (8 Replies)
Discussion started by: laknar
8 Replies
9. Shell Programming and Scripting
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
Hi -
I have below in put to demo.txt
/test/xyz/ibcdownload.jsp
/test/xyz/pvxprogramtreeovermain.jsp
/test/xyz/jtfrsrsr$HtmlTag.jsp
/test/xyz/csdronumlov.jsp
/test/xyz/iecvaluereset.jsp
/test/xyz/ibecumpassignrole.jsp
/test/xyz/ozfoffermarketmain.jsp
output should be... (4 Replies)
Discussion started by: oraclermanpt
4 Replies
LEARN ABOUT CENTOS
compose
Compose(5) File Formats Manual Compose(5)
NAME
Compose - X client mappings for multi-key input sequences
DESCRIPTION
The X library, libX11, provides a simple input method for characters beyond those represented on typical keyboards using sequences of key
strokes that are combined to enter a single character.
The compose file is searched for in the following order:
- If the environment variable $XCOMPOSEFILE is set, its value is used as the name of the Compose file.
- If the user's home directory has a file named .XCompose, it is used as the Compose file.
- The system provided compose file is used by mapping the locale to a compose file from the list in /usr/share/X11/locale/compose.dir.
Compose files can use an "include" instruction. This allows local modifications to be made to existing compose files without including all
of the content directly. For example, the system's iso8859-1 compose file can be included with a line like this:
include "%S/iso8859-1/Compose"
There are several substitutions that can be made in the file name of the include instruction:
%H expands to the user's home directory (the $HOME environment variable)
%L expands to the name of the locale specific Compose file (i.e., "/usr/share/X11/locale/<localename>/Compose")
%S expands to the name of the system directory for Compose files (i.e., "/usr/share/X11/locale")
For example, you can include in your compose file the default Compose file by using:
include "%L"
and then rewrite only the few rules that you need to change. New compose rules can be added, and previous ones replaced.
FILE FORMAT
Compose files are plain text files, with a separate line for each compose sequence. Comments begin with # characters. Each compose
sequence specifies one or more events and a resulting input sequence, with an optional comment at the end of the line:
EVENT [EVENT...] : RESULT [# COMMENT]
Each event consists of a specified input keysym, and optional modifier states:
[MODIFIER_LIST] <keysym>
Each modifier consists of a specified modifier and a state:
(! MODIFIER ) | None
Modifiers may be preceded by a "~" character to indicate that the modifier must not be present.
The result specifies a string, keysym, or both, that the X client receives as input when the sequence of events is input:
"STRING" | keysym | "STRING" keysym
Keysyms are specified without the XK_ prefix.
Strings may be direct text encoded in the locale for which the compose file is to be used, or an escaped octal or hexadecimal character
code. Octal codes are specified as "123" and hexadecimal codes as "