Sponsored Content
Top Forums Programming string with invalid characters Post 302222836 by cleopard on Thursday 7th of August 2008 03:27:34 PM
Old 08-07-2008
string with invalid characters

This is a pretty straight-forward question. Within a program of mine, I have a string that's going to be used as a filename, but it might have some invalid characters in it that wouldn't be valid in a filename. If there are any invalid characters, I want to get rid of them and essentially squeeze the remaining characters together to form a valid filename.

I can't seem to find any string function that might help to assist in making this a more efficient than simply checking the string char by char, moving the valid chars into another string while ignoring the invalid ones, creating a valid filename.

Just thought I'd ask and see what kind of input I would receive. Thank you.
 

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
curs_scr_dump(3X)														 curs_scr_dump(3X)

NAME
scr_dump, scr_restore, scr_init, scr_set - read (write) a curses screen from (to) a file SYNOPSIS
#include <curses.h> int scr_dump(const char *filename); int scr_restore(const char *filename); int scr_init(const char *filename); int scr_set(const char *filename); DESCRIPTION
The scr_dump routine dumps the current contents of the virtual screen to the file filename. The scr_restore routine sets the virtual screen to the contents of filename, which must have been written using scr_dump. The next call to doupdate restores the screen to the way it looked in the dump file. The scr_init routine reads in the contents of filename and uses them to initialize the curses data structures about what the terminal cur- rently has on its screen. If the data is determined to be valid, curses bases its next update of the screen on this information rather than clearing the screen and starting from scratch. scr_init is used after initscr or a system [see system(BA_LIB)] call to share the screen with another process which has done a scr_dump after its endwin call. The data is declared invalid if the terminfo capabilities rmcup and nrrmc exist; also if the terminal has been written to since the preceding scr_dump call. The scr_set routine is a combination of scr_restore and scr_init. It tells the program that the information in filename is what is cur- rently on the screen, and also what the program wants on the screen. This can be thought of as a screen inheritance function. To read (write) a window from (to) a file, use the getwin and putwin routines [see curs_util(3X)]. RETURN VALUE
All routines return the integer ERR upon failure and OK upon success. NOTES
Note that scr_init, scr_set, and scr_restore may be macros. PORTABILITY
The XSI Curses standard, Issue 4, describes these functions (adding the const qualifiers). The SVr4 docs merely say under scr_init that the dump data is also considered invalid "if the time-stamp of the tty is old" but don't define "old". SEE ALSO
curses(3X), curs_initscr(3X), curs_refresh(3X), curs_util(3X), system(3S) curs_scr_dump(3X)
All times are GMT -4. The time now is 01:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy