Sponsored Content
Top Forums Shell Programming and Scripting How to test that a string doesn't contain specific characters? Post 302984423 by disedorgue on Tuesday 25th of October 2016 06:18:24 PM
Old 10-25-2016
In your case, you must set LC_ALL=C because you want exclude characters with accent.

Regards.
This User Gave Thanks to disedorgue For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

replacing specific characters in a string

Hi Friends, Following is an output of a script OPWQERIUTYKLSADFJHGXZNMCVBWQOPERIUTYKLSADFJHGXZNMCVB I want to replace above string's 11 to 17 character by ******* (7 stars) How can it be done? Please somebody guide me. (6 Replies)
Discussion started by: anushree.a
6 Replies

2. Shell Programming and Scripting

Test on string containing spacewhile test 1 -eq 1 do read a $a if test $a = quitC then break fi d

This is the code: while test 1 -eq 1 do read a $a if test $a = stop then break fi done I read a command on every loop an execute it. I check if the string equals the word stop to end the loop,but it say that I gave too many arguments to test. For example echo hello. Now the... (1 Reply)
Discussion started by: Max89
1 Replies

3. Shell Programming and Scripting

How to check weather a string is like test* or test* ot *test* in if condition

How to check weather a string is like test* or test* ot *test* in if condition (5 Replies)
Discussion started by: johnjerome
5 Replies

4. Programming

Kernel module - How to test if file doesn't exist

Hey, I'm currently getting into some kernel module progamming. As a little exercise I want to read the headers out of an ELF file. My code is very simple, here is the important part: struct file *fp; /* ... */ fp = filp_open("some/file/on/my/pc", O_RDONLY, 0); if(fp == NULL) { ... (15 Replies)
Discussion started by: disaster
15 Replies

5. Shell Programming and Scripting

Value of variable is NULL, but test doesn't seem to recognize

Hello, Unix-forums! My problem: read -p "Enter any number, please" number sleep 1 echo $number | tr -d 0-9 test -z $number && echo "Thank you" || echo "This is not a number"Test always displays "This is not a number". It doesn't matter if I entered a or 1. But if I order echo... (2 Replies)
Discussion started by: intelinside
2 Replies

6. Shell Programming and Scripting

sed replacing specific characters and control characters by escaping

sed -e "s// /g" old.txt > new.txt While I do know some control characters need to be escaped, can normal characters also be escaped and still work the same way? Basically I do not know all control characters that have a special meaning, for example, ?, ., % have a meaning and have to be escaped... (11 Replies)
Discussion started by: ijustneeda
11 Replies

7. Shell Programming and Scripting

Can't figure out how to find specific characters in specific columns

I am trying to find a specific set of characters in a long file. I only want to find the characters in column 265 for 4 bytes. Is there a search for that? I tried cut but couldn't get it to work. Ex. I want to find '9999' in column 265 for 4 bytes. If it is in there, I want it to print... (12 Replies)
Discussion started by: Drenhead
12 Replies

8. Shell Programming and Scripting

Count specific characters at specific column positions

Hi all, I need help. I have an input text file (input.txt) like this: 21 GTGCAACACCGTCTTGAGAGG 50 21 GACCGAGACAGAATGAAAATC 73 21 CGGGTCTGTAGTAGCAAACGC 108 21 CGAAAAATGAACCCCTTTATC 220 21 CGTGATCCTGTTGAAGGGTCG 259 Now I need to count A/T/G/C numbers at each character location in column... (2 Replies)
Discussion started by: thienxho
2 Replies

9. Shell Programming and Scripting

[Solved] If doesn't evaluate the first test

Good afternoon, I am tearing hair out over this. It should be so simple. I have an if statement to evaluate whether or not replication is working. I am testing variables from mysql to see if they are both "Yes". I have put some echo statements in to see how far the code proceeds. It always... (6 Replies)
Discussion started by: jimm
6 Replies

10. Shell Programming and Scripting

Test command non case specific string comparision

Hi, I want to do caseless string comparision using test command for eg: Ind_f="y" test "$Ind_f" == "y|Y" i tried , ** , nothing worked. any thoughts on how to do case insensitive string comparison using test command without converting to any particular case using typeset or tr? (8 Replies)
Discussion started by: Kulasekar
8 Replies
Cz::Cstocs(3pm) 					User Contributed Perl Documentation					   Cz::Cstocs(3pm)

NAME
Cz::Cstocs - conversions of charset encodings for the Czech language SYNOPSIS
use Cz::Cstocs; my $il2_to_ascii = new Cz::Cstocs 'il2', 'ascii'; while (<>) { print &$il2_to_ascii($_); } use Cz::Cstocs 'il2_ascii'; while (<>) { print il2_ascii($_); } use Cz::Cstocs; sub il2toascii; # inform the parser that there is a function il2toascii *il2toascii = new Cz::Cstocs 'il2', 'ascii'; # now define the function print il2toascii $data; # thanks to Jan Krynicky for poining this out DESCRIPTION
This module helps in converting texts between various charset encodings, used for Czech and Slovak languages. The instance of the object Cz::Cstocs is created using method new. It takes at least two parameters for input and output encoding and can be afterwards used as a function reference to convert strings/lists. Cz::Cstocs supports fairly free form of aliases, so iso8859-2, ISO-8859-2, iso88592 and il2 are all aliases of the same encoding. For backward compatibility, method conv is supported as well, so the example above could also read while (<>) { print $il2_to_ascii->conv($_); } You can also use typeglob syntax. The conversion function takes a list and returns list of converted strings (in the list context) or one string consisting of concatenated results (in the scalar context). You can modify the behaviour of the conversion function by specifying hash of other options after the encoding names in call to new. fillstring Gives alternate string that will replace characters from input encoding that are not present in the output encoding. Default is space. use_accent Defines whether the accent file should be used. Default is 1 (true). nofillstring When 1 (true), will keep characters that do not have friends in accent nor output encoding, will no replace them with fillstring. Default is 0 except for tex, because you probably rather want to keep backslashed symbols than loose them. cstocsdir Alternate location for encoding and accent files. The default is the Cz/Cstocs/enc directory in Perl library tree. This location can also be changed with the CSTOCSDIR environment variable. There is an alternate way to define the conversion function: any arguments after use Cz::Cstocs that have form encoding_encoding or encoding_to_encoding are processed and the appropriate functions are imported. So, use Cz::Cstocs qw(pc2_to_il2 il2_ascii); define two functions, that are loaded into caller's namespace and can be used directly. In this case, you cannot specify additional options, you only have default behaviour. ERROR HANDLING
If you request an unknown encoding in the call to new Cz::Cstocs, the conversion object is not defined and the variable $Cz::Cstocs::errstr is set to the error message. When you specify unknown encoding in the use call style (like "use Cz::Cstocs 'il2_ascii';"), the die is called. AUTHOR
Jan Pazdziora, adelton@fi.muni.cz, created the module version. Jan "Yenya" Kasprzak has done the original Un*x implementation. VERSION
3.4 SEE ALSO
cstocs(1), perl(1), or Xcstocs at http://www.lut.fi/~kurz/programs/xcstocs.tar.gz. perl v5.10.1 2002-10-17 Cz::Cstocs(3pm)
All times are GMT -4. The time now is 11:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy