Sponsored Content
Top Forums Shell Programming and Scripting delete all characters that aren't a letter or number Post 302591886 by durden_tyler on Saturday 21st of January 2012 10:20:39 AM
Old 01-21-2012
You could also use the POSIX character class "[:alnum:]" like so -

Code:
$
$ echo $str
lewisdennyİ
$
$ str=$(echo $str | sed 's/[^[:alnum:]]//g')
$
$ echo $str
lewisdenny
$
$

tyler_durden
 

10 More Discussions You Might Find Interesting

1. AIX

Delete specific characters

Hi every1 Well i have a list of numbers e.g 12304 13450 01234 00123 14567 what i want is a command to check if the number is starting from 0 and then delete the 0 without doing anything else!!!! any help wud b appreciated!!!!!!!!:( (4 Replies)
Discussion started by: masquerer
4 Replies

2. Shell Programming and Scripting

Delete lines that starts with a certain letter

How can I delete those lines that starts with a certain letter? abc def ghi xyz abc def ace gik moq abe imq gxm I want to delete the line that starts with "x". Thanks! (4 Replies)
Discussion started by: kingpeejay
4 Replies

3. Shell Programming and Scripting

How to delete characters using a file

Hi All, I have a configuration file (file.cfg) in which data will be like this ; , _ + a to z A to Z Now i have to read a textfile (file.txt) and i need to check whether there is any other character present in text file that is not existing in (file.cfg). If other characters are present... (4 Replies)
Discussion started by: krishna_gnv
4 Replies

4. Shell Programming and Scripting

Check input for lenght, special characters and letter case

I made menu script for users so they can run other script without going in shell just from menu. But i must control their input. These are criteria: Input must have 4 signs First two signs are always lower case letters Input shall not have some special signs just letters and numbers ... (1 Reply)
Discussion started by: waso
1 Replies

5. Shell Programming and Scripting

Get letter from number and assign to a variable

Hi to all in forum, I'm trying to convert the letter number between 1 (A) and 26 (Z), that part is working, my issue is how to assign the printf output to a variable:LetterNumber=10 printf "\x$(printf %x $((${LetterNumber}+64)))" $ J #The problem, how to assign printf output (J in this... (8 Replies)
Discussion started by: Ophiuchus
8 Replies

6. Shell Programming and Scripting

Sed/awk to delete single lines that aren't touching other lines

Hello, I'm trying to figure out how to use sed or awk to delete single lines in a file. By single, I mean lines that are not touching any other lines (just one line with white space above and below). Example: one two three four five six seven eight I want it to look like: (6 Replies)
Discussion started by: slimjbe
6 Replies

7. Shell Programming and Scripting

how to delete the line if the first letter is a single digit

Hi, I'm trying to acheive the following, I have a dat file in which i have several addresses, If the address starts with a single digit then i have to delete the line, if it starts with 2 or more digits then i have to keep the line Here is a sample of my file: 377 CARRER DE LA... (5 Replies)
Discussion started by: ramky79
5 Replies

8. UNIX for Dummies Questions & Answers

Assigning a number to a letter without printing it

Hello Unix.com ! Newbie question. With awk, i can we give a particular letter a number without printing the number? input: X|X A|X A|A X|A If field is "A", then it counts as 2 If field is "X", then it counts as 3 Multiply the 2 first field and give the result in the 3th field, but... (7 Replies)
Discussion started by: beca123456
7 Replies

9. UNIX for Dummies Questions & Answers

Delete all words not containing letter /s/

I have a word file that looks like: pens binder spiral user I want to delete all the words without the letter /s/, so output looks like: pens spiral user I tried using sed: sed '//d' infile.txt > out.txt (5 Replies)
Discussion started by: pxalpine
5 Replies

10. Shell Programming and Scripting

Replace specific letter in a file by other letter

Good afternoon all, I want to ask how to change some letter in my file with other letter in spesific line eg. data.txt 1 1 1 0 0 0 0 for example i want to change the 4th line with character 1. How could I do it by SED or AWK. I have tried to run this code but actually did not... (3 Replies)
Discussion started by: weslyarfan
3 Replies
MSGFMT_GET_ERROR_CODE(3)						 1						  MSGFMT_GET_ERROR_CODE(3)

MessageFormatter::getErrorCode - Get the error code from last operation

	Object oriented style

SYNOPSIS
public int MessageFormatter::getErrorCode (void ) DESCRIPTION
Procedural style int msgfmt_get_error_code (MessageFormatter $fmt) Get the error code from last operation. PARAMETERS
o $fmt - The message formatter RETURN VALUES
The error code, one of UErrorCode values. Initial value is U_ZERO_ERROR. EXAMPLES
Example #1 msgfmt_get_error_code(3) example <?php $fmt = msgfmt_create("en_US", "{0, number} monkeys on {1, number} trees"); $str = msgfmt_format($fmt, array()); if(!$str) { echo "ERROR: ".msgfmt_get_error_message($fmt) . " (" . msgfmt_get_error_code($fmt) . ") "; } ?> Example #2 OO example <?php $fmt = new MessageFormatter("en_US", "{0, number} monkeys on {1, number} trees"); $str = $fmt->format(array()); if(!$str) { echo "ERROR: ".$fmt->getErrorMessage() . " (" . $fmt->getErrorCode() . ") "; } ?> The above example will output: ERROR: msgfmt_format: not enough parameters: U_ILLEGAL_ARGUMENT_ERROR (1) SEE ALSO
msgfmt_get_error_message(3), intl_get_error_code(3), intl_is_failure(3). PHP Documentation Group MSGFMT_GET_ERROR_CODE(3)
All times are GMT -4. The time now is 11:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy