Sponsored Content
Top Forums Programming string with invalid characters Post 302222841 by jim mcnamara on Thursday 7th of August 2008 03:43:29 PM
Old 08-07-2008
IF you mean C, then yes, you use a char pointer to step thru the source string, copying only good characters to the destination string, using ctype.h macros maybe like:
isascii(),
isspace(),
iscntrl()

to check the 'goodness' of the character. The definition of what is good is partly up to you - some chars like * are valid in filenames but can cause hell to break loose when you actually use them. Otherwise use tr like Franklin says.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Invalid Characters in the file.

I am working on AIX. We ftp files to a database. The flat files are having thousands of records and each record is having some 50 to 60 characters(there are fields having certain character length). In addition to some valid ascii characters some invalid characters like Å, å, Ä, ä or pipes creep in which... (5 Replies)
Discussion started by: kanu_pathak
5 Replies

2. UNIX for Dummies Questions & Answers

Invalid Characters in the file.

I am working on AIX. We ftp files to a database. The flat files are having thousands of records and each record is having some 50 to 60 characters(there are fields having certain character length). In addition to some valid ascii characters some invalid characters like Å, å, Ä, ä or pipes creep in which... (15 Replies)
Discussion started by: kanu_pathak
15 Replies

3. Shell Programming and Scripting

Add string after another string with special characters

Hello everyone, I'm writing a script to add a string to an XML file, right after a specified string that only occurs once in the file. For testing purposes I created a file 'testfile' that looks like this: 1 2 3 4 5 6 6 7 8 9 And this is the script as far as I've managed: ... (2 Replies)
Discussion started by: heliode
2 Replies

4. Shell Programming and Scripting

writing shell script to find line of invalid characters

Hi, I have to write s script to check an input file for invalid characters. In this script I have to find the exact line of the invalid character. If the input file contain 2 invalid character sat line 10 and 17, the script will show the value 10 and 17. Any help is appreciated. (3 Replies)
Discussion started by: beginner82
3 Replies

5. Shell Programming and Scripting

get certain characters in a string

Hi Everyone, I have a.txt 12341" <sip:191@vo.my>;asdf=q" 116aaaa<sip:00091@vo.my>;penguin would like to get the output 191 00091 Please advice. Thanks (4 Replies)
Discussion started by: jimmy_y
4 Replies

6. Shell Programming and Scripting

remove characters from string based on occurrence of a string

Hello Folks.. I need your help .. here the example of my problem..i know its easy..i don't all the commands in unix to do this especiallly sed...here my string.. dwc2_dfg_ajja_dfhhj_vw_dec2_dfgh_dwq desired output is.. dwc2_dfg_ajja_dfhhj it's a simple task with tail... (5 Replies)
Discussion started by: victor369
5 Replies

7. Shell Programming and Scripting

Remove invalid database characters on a file

Hi All - I'm building a script wherein it is design to remove characters that are not accepted on a non-unicode database. Examples are the following: ï,¿,½,Â,é, etc. I can easily sed those characters one-by-one but I there's a problem when other unicode characters are found. Is there any way to... (1 Reply)
Discussion started by: Jin_
1 Replies

8. UNIX for Dummies Questions & Answers

To get the invalid characters from a file

Hello, Can any one help me in below query to search all the invalid characters that UNIX cannot recognize from a file. can we do anything with the help of grep command or any other commands. Also, i am not sure what are the invalid characters present in the file. Many thanks in advance. ... (6 Replies)
Discussion started by: schandru
6 Replies

9. UNIX for Beginners Questions & Answers

Invalid arithmetic operator on string concatenation

Hello. LEAP_VERSION="4.2" export ARRAY_MAIN_REPO_LEAP=('zypper_local' 'openSUSE-Leap-'"$LEAP_VERSION"'-Non-Oss' 'openSUSE-Leap-'"$LEAP_VERSION"'-Oss' 'openSUSE-Leap-'"$LEAP_VERSION"'-Update' 'openSUSE-Leap-'"$LEAP_VERSION"'-Update-Non-Oss')Seems that the - is interpreted as a numeric... (2 Replies)
Discussion started by: jcdole
2 Replies

10. Shell Programming and Scripting

Outputting characters after a given string and reporting the characters in the row below --sed

I have this fastq file: @M04961:22:000000000-B5VGJ:1:1101:9280:7106 1:N:0:86 GGGGGGGGGGGGCATGAAAACATACAAACCGTCTTTCCAGAAATTGTTCCAAGTATCGGCAACAGCTTTATCAATACCATGAAAAATATCAACCACACCA +test-1 GGGGGGGGGGGGGGGGGCCGGGGGFF,EDFFGEDFG,@DGGCGGEGGG7DCGGGF68CGFFFGGGG@CGDGFFDFEFEFF:30CGAFFDFEFF8CAF;;8... (10 Replies)
Discussion started by: Xterra
10 Replies
fnmatch(3C)															       fnmatch(3C)

NAME
fnmatch() - match filename patterns SYNOPSIS
DESCRIPTION
performs pattern matching as described in regexp(5) under By default, the rule qualifications for filename expansion do not apply; i.e., periods (dots) and slashes are matched as ordinary characters. This default behavior can be modified by using the flags described below. The flag argument modifies the interpretation of pattern and string. If which is defined in is set in flag, a slash character in string must be explicitly matched by a slash in pattern; it cannot be matched by either the asterisk or question mark special characters or by a bracket expression. If is set in flag, a leading period must be explicitly matched. It will not be matched by a bracket expression, question mark or asterisk. By default, a period is leading if it is the first character in string. If is set in flag, a period is leading if it is the first charac- ter in string or immediately follows a slash. If is not set in flag, a backslash character in pattern followed by any other character matches that second character in string. In par- ticular, matches a backslash in string. If is set, a backslash character is treated as an ordinary character. If flag is zero, the slash character and the period are treated as regular characters. If flag has any other value, the result is unde- fined. RETURN VALUE
If string matches the pattern specified by pattern, returns zero. Otherwise, returns non-zero. EXAMPLE
The following excerpt uses to check each file in a directory against the pattern pattern = "*.c"; while(dp = readdir(dirp)){ if((fnmatch(pattern, dp->d_name,0)) == 0){ /* do processing for match */ ... } } AUTHOR
was developed by OSF and HP. SEE ALSO
sh(1), glob(3C), thread_safety(5). STANDARDS CONFORMANCE
fnmatch(3C)
All times are GMT -4. The time now is 05:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy