Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Question/review my script: removing bad chars from filenames Post 302459146 by agama on Sunday 3rd of October 2010 11:07:06 PM
Old 10-04-2010
You can replace \t with the tab character if your sed doesn't support it. I use AT&T's sed from their AST tool set. Also, if [:space:] includes tab (too lazy to look it up tonight), then you don't need it at all.

Does your shell allow this:
Code:
sed 's/[]['"'"'!@#$%^&*()`~[:cntrl:][:space:]        ]//g'

That's a single quote to close, then a single quote inside of double quotes and finally a single quote to reopen.

If this fails then I'm out of suggestions.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

removing the extension from all filenames in a folder

Hi there, I'm pretty new to UNIX and have tried trawling through this forum to find an answer to what I want to try to do, which I'm sure is very simple but I don't know how to do it. What I have a a folder that contains multiple files that I have copied from Windows and I want to remove the... (5 Replies)
Discussion started by: johnmcclintock
5 Replies

2. Shell Programming and Scripting

removing non-printable chars from multiple files

How do I remove non-printable characters from all txt files and output the results to one file? I've tried the following: tr -cd '\n' < *.txt > out.txt and it gives ambiguous redirect error. How can I get it to operate on all txt files in the current directory and append the output to... (1 Reply)
Discussion started by: revax
1 Replies

3. Shell Programming and Scripting

SED: Removing Filenames From Paths

I'm using a script with a lot of SED commands, in conjunction with grep, cut, etc. I've come up against a wall with a particular road block: I output a file from an SVN registry that gives me a list of files. The list consists of a variable number of lines that contain a path/file. The paths... (4 Replies)
Discussion started by: Brusimm
4 Replies

4. Shell Programming and Scripting

removing spaces in filenames

I have a problem mounting images because of the spaces in the filenames. Does anyone know how to rename files by removing the spaces with the find command? find Desktop/$dir -name "*.dmg" -print -exec ??? (4 Replies)
Discussion started by: ianebaj
4 Replies

5. Shell Programming and Scripting

removing file with bad characters

I have the following files in the same directory but if you look at the od output you can see one of the files has and "\n" as part of the file name. Is there a way I can only remove the file with the "\n" as part of the file name without affecting the other file. I was thinking about... (4 Replies)
Discussion started by: BeefStu
4 Replies

6. Shell Programming and Scripting

Removing unknow chars from file names.

I'm trying to move a large folder to an external drive but some files have these weird chars that the external drive won't accept. Does anyone know any command of any bash script that will look through a given folder and remove any weird chars? (4 Replies)
Discussion started by: Joktaa
4 Replies

7. Shell Programming and Scripting

Removing rows and chars from text file

Dear community, maybe I'm asking the moon :rolleyes:, but I'm scratching my head to find a solution for it. :wall: I have a file called query.out (coming from Oracle query), the file is like this: ADDR TOTAL -------------------- ---------- TGROUPAGGR... (16 Replies)
Discussion started by: Lord Spectre
16 Replies

8. UNIX for Advanced & Expert Users

Removing special chars from file and maintain field separator

Running SunOs 5.6. Solaris. I've been able to remove all special characters from a fixed length file which appear in the first column but as a result all subsequent columns have shifted to the left by the amount of characters deleted. It is a space separated file. Line 1 in input file is... (6 Replies)
Discussion started by: iffy290
6 Replies

9. UNIX for Beginners Questions & Answers

Change encoding, no removing special chars. inconv

Hi all, I'm using iconv command to change files encoding to UTF-8 If my input file has chars as those are removed creating the file without those special chars. I tried using iconv -c, but there is still the removal. Is there a way to keep those special chars changing just the... (6 Replies)
Discussion started by: mrreds
6 Replies

10. UNIX for Beginners Questions & Answers

Shell script to split data with a delimiter having chars and special chars

Hi Team, I have a file a1.txt with data as follows. dfjakjf...asdfkasj</EnableQuotedIDs><SQL><SelectStatement modified='1' type='string'><! The delimiter string: <SelectStatement modified='1' type='string'><! dlm="<SelectStatement modified='1' type='string'><! The above command is... (7 Replies)
Discussion started by: kmanivan82
7 Replies
GENCAT(1)						    BSD General Commands Manual 						 GENCAT(1)

NAME
gencat -- NLS catalog compiler SYNOPSIS
gencat output-file input-files... DESCRIPTION
The gencat utility merges the text NLS input files input-files... into a formatted message catalog file output-file. The file output-file will be created if it does not already exist. If output-file does exist, its messages will be included in the new output-file. If set and message numbers collide, the new message text defined in input-files... will replace the old message text currently contained in output-file. INPUT FILES
The format of a message text source file is defined below. Note that the fields of a message text source line are separated by a single space character: any other space characters are considered to be part of the field contents. $set n comment This line specifies the set identifier of the following messages until the next $set or end-of-file appears. The argument n is the set identifier which is defined as a number in the range [1, (NL_SETMAX)]. Set identifiers must occur in ascending order within a single source file, but need not be contiguous. Any string following a space following the set identifier is treated as a comment. If no $set directive is specified in a given source file, all messages will be located in the default message set NL_SETD. $del n comment This line deletes messages from set n from a message catalog. The n specifies a set number. Any string following a space following the set number is treated as a comment. $ comment A line beginning with $ followed by a space is treated as a comment. m message-text A message line consists of a message identifier m in the range [1, (NL_MSGMAX)]. The message-text is stored in the message catalog with the set identifier specified by the last $set directive, and the message identifier m. If the message-text is empty, and there is a space character following the message identifier, an empty string is stored in the message catalog. If the message-text is empty, and if there is no space character following the message identifier, then the existing message in the current set with the specified message identifier is deleted from the catalog. Message identifiers must be in ascending order within a single set, but need not be contiguous. The message-text length must be in the range [0, (NL_TEXTMAX)]. $quote c This line specifies an optional quote character c which can be used to surround message-text so that trailing space or empty messages are visible in message source files. By default, or if an empty $quote directive is specified, no quoting of message-text will be rec- ognized. Empty lines in message source files are ignored. The effect of lines beginning with any character other than those described above is unde- fined. Text strings can contain the following special characters and escape sequences. In addition, if a quote character is defined, it may be escaped as well to embed a literal quote character. line feed horizontal tab v vertical tab  backspace carriage return f form feed \ backslash ooo octal number in the range [000, 377] A backslash character immediately before the end of the line in a file is used to continue the line onto the next line, e.g.: 1 This line is continued on this line. If the character following the backslash is not one of those specified, the backslash is ignored. DIAGNOSTICS
The gencat utility exits 0 on success, and >0 if an error occurs. SEE ALSO
catclose(3), catgets(3), catopen(3) STANDARDS
The gencat utility is compliant with the X/Open Portability Guide Issue 4 (``XPG4'') standard. AUTHORS
This manual page was originally written by Ken Stailey and later revised by Terry Lambert. BUGS
A message catalog file created from a blank input file cannot be revised; it must be deleted and recreated. BSD
June 11, 1997 BSD
All times are GMT -4. The time now is 05:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy