For example, I want to replace CTRL-I with an underscore, tabs with 3 spaces, CTRL-M with UNIX's newline etc.
You can simply use sed to that that, eventually embedded in a script (tabs and spaces written as <t> and <b> for clarity, use literal tabs/spaces when writing):
Use the script like:
As you enter the script in vi notice that you can enter any non-printing character pressing <CTRL>-<V> and then your character, i.e <CTRL><I> literally.
A word of caution about "^M" characters: look at my take on it. You probably don't want to change any "^M" but only thos at line ends. The one on line ends you don't want to change into anything, just remove them. They are probably being left over from a DOS<->UNIX file transfer and as DOS has two characters signifying the line change and UNIX has only one you simply remove them.
the problem is while replacing the old string with new one with the help of SED i am unable to replace the special characters with new strings. how can i do that?
i dont want the user to be given the trouble to write '\' before every special characters like * , . , \ , $ , &.
sed... (4 Replies)
Hi,
I have tonnes of .txt files that are written in French. I need to replace the French special characters, however, with English equivalents (e.g. é -> e and ç -> c).
I have tried this
---
#!/bin/bash
# Convert French characters to normal characters
# Treat each of the files
exec... (4 Replies)
Hello,
I have a file with many lines with below format:
\abc\\1234
jkl\\567
def\\345
\pqr\\567
\xyz\\234
Here, i need to do 2 things.
1. replace \\ with \
2. remove starting \
so output to be as below: (11 Replies)
Hello. How can i put all of the special characters on my keyboard into a string in c++ ?
I tried this but it doesn't work.
string characters("~`!@#$%^&*()_-+=|\}]{
How can i accomplish this?
Thanks in advance. (1 Reply)
Hi,
I am trying to replace a string in shell but it is not working correctly.
@xcom.file@
needs to be replaced with
tb137
Plz help.Thx.
Please use and tags when posting code, data or logs etc. to preserve formatting and enhance readability, thanks. (4 Replies)
I am writing a ksh script. I need to replace a set of characters in an xml file.
FROM="ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÛÚÜÝßàáâãäåçèéêëìíîïðñòóôõö¿¶ø®";
TO="AAAAAAACEEEEIIIIDNOOOOOOUUUUYSaaaaaaceeeeiiiionooooo N R"
I have used the code- sed 's/$FROM/$TO/g'<abc.xml
But its not working.
Can anyone tell me the code to do this? (3 Replies)
I have a .CSV file when I check for the special characters in the file using the command cat -vet filename.csv, i get very lengthy lines with "^@", "^I^@" and "^@^M" characters in between each alphabet in all of the records. Using the code below file filename.csv I get the output as
I have a... (2 Replies)
**Extremely sorry for the typos in heading
Old:CAST ('${DEFAULT_HIGH_DATE}' AS DATE FORMAT 'YYYY-MM-DD')
New :CAST(CAST('${G_DEFAULT_HIGH_DATE}' AS DATE FORMAT 'MM-DD-YYYY') as DATE FORMAT 'YYYY-MM-DD')
Need to change old format as new format
cat file1
CAST ('${DEFAULT_HIGH_DATE}' AS... (1 Reply)
Hi,
Please find attached a file that has special characters on it. It is a copy and paste from a Micro$oft file.
I don't want to use strings as it remove all the 'indentations' / 'formatting' so I am replacing them with space instead.
I am using the sed command below
sed "s/$(printf... (1 Reply)
Discussion started by: newbie_01
1 Replies
LEARN ABOUT CENTOS
set_ucodepage
set_ucodepage(3alleg4) Allegro manual set_ucodepage(3alleg4)NAME
set_ucodepage - Sets 8-bit to Unicode conversion tables. Allegro game programming library.
SYNOPSIS
#include <allegro.h>
void set_ucodepage(const unsigned short *table, const unsigned short *extras);
DESCRIPTION
When you select the U_ASCII_CP encoding mode, a set of tables are used to convert between 8-bit characters and their Unicode equivalents.
You can use this function to specify a custom set of mapping tables, which allows you to support different 8-bit codepages.
The `table' parameter points to an array of 256 shorts, which contain the Unicode value for each character in your codepage. The `extras'
parameter, if not NULL, points to a list of mapping pairs, which will be used when reducing Unicode data to your codepage. Each pair con-
sists of a Unicode value, followed by the way it should be represented in your codepage. The list is terminated by a zero Unicode value.
This allows you to create a many->one mapping, where many different Unicode characters can be represented by a single codepage value (eg.
for reducing accented vowels to 7-bit ASCII).
Allegro will use the `table' parameter when it needs to convert an ASCII string to an Unicode string. But when Allegro converts an Unicode
string to ASCII, it will use both parameters. First, it will loop through the `table' parameter looking for an index position pointing at
the Unicode value it is trying to convert (ie. the `table' parameter is also used for reverse matching). If that fails, the `extras' list
is used. If that fails too, Allegro will put the character `^', giving up the conversion.
Note that Allegro comes with a default `table' and `extras' parameters set internally. The default `table' will convert 8-bit characters to
`^'. The default `extras' list reduces Latin-1 and Extended-A characters to 7 bits in a sensible way (eg. an accented vowel will be
reduced to the same vowel without the accent).
SEE ALSO set_uformat(3alleg4)Allegro version 4.4.2 set_ucodepage(3alleg4)