04-25-2007
Control character in a file
Hi All,
I am looking for a solution to capture any ASCII control character in a file
( where the ASCII control character is in decimal value from 0 to 31 and 127
( Hex value from 00 to 1F and 7F ) ) by returning any affected lines.
The intended good file should contain "ASCII printable character" where ASCII
printable character is in decimal value from 32 to 126 ( Hex value from 20 to
7E ).
Thanks in advance.
Best regards,
cursive
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I'm using MKS tool kit to execute KSH on windows and samba to move files to unix from windows.
My script is appending header record for the data file.
I'm using
echo "$header" > $SambaFilename
cat $windowsfile >> $SambaFilename
But after execution of script ,The file in Unix... (2 Replies)
Discussion started by: ammu
2 Replies
2. UNIX for Dummies Questions & Answers
can any one say about command to find "^M" (Control M)characters in a unix text file.
^M comes when a file ftped from windows to unix without using bin mode.
I need the command to find lik this,
ex.txt:
------------------------------
...,name,time^M
go^M
...file,end^M... (5 Replies)
Discussion started by: prsam
5 Replies
3. Shell Programming and Scripting
Need to replace any control character in the string in perl
---------- Post updated at 04:22 PM ---------- Previous update was at 03:50 PM ----------
Any help !!!
Thanks in advance (2 Replies)
Discussion started by: hansini
2 Replies
4. UNIX for Dummies Questions & Answers
Sorry to bug you, but my sed is failing me,
I have a file auto generated from abinitio, it has a string of chars ending with a line break, and then it has added a ^A character, I can remove this is vi by using the following %s/^A//g (where ^A is ctrl v and control A), however when I try to sed... (1 Reply)
Discussion started by: badg3r
1 Replies
5. Programming
I am getting error when loading data file using ctl file. I get this error only when there is special character.
Below is some data.
DataFile=>
company_id|ciu_id|english_name|iso_country_code|active|partner_name
1-2JT-122||Expert Järvenpää|FI|A|Expert Järvenpää
Control File=>
LOAD DATA... (1 Reply)
Discussion started by: rshivarkar
1 Replies
6. Shell Programming and Scripting
In a 10-50GB file , at end of file there is Control-z character
tried the below options,
1. perl -p -i -e 's/^Z//g' new.txt
2. perl -0777lwi -032e0 new.txt
and Sed command, dos2unix etc
it takes more time to remove the control-z. need a command or perl program to GO TO LAST LINE OF FILE ... (7 Replies)
Discussion started by: prsam
7 Replies
7. Shell Programming and Scripting
in a file we are getting control character in a file , is there any way that they can be removed once we have the file
for eg.
BEGIN-PROCEDURE INITIALIZE
^M
LET #row_count = 0^M
^M
^M (2 Replies)
Discussion started by: lalitpct
2 Replies
8. Shell Programming and Scripting
I have to write a program to read data from files and then format into another file. However, I face a strange problem related to control character that I can't understand and solve.
The source file is compose of many lines with such format:
T_NAME|P_NAME|P_CODE|DOCUMENT_PATH|REG_DATE
... (3 Replies)
Discussion started by: hk6279
3 Replies
9. Shell Programming and Scripting
Hi All,
We are getting an external file in abc.csv format. When opened in excel spread sheet, it is opening alright. But when opened in notepad, I see the contents in a single line.
Ftp'd the file in binary mode to AIX UNIX host. When opened, I see Control M (^M) characters in place of New Line... (16 Replies)
Discussion started by: njny
16 Replies
10. UNIX for Dummies Questions & Answers
I've got a file where each line is separated by ^M characters. I want to be able to cat the file without those lines. When I cat the file now what I see are blank lines. However, the blank lines are actually ^M characters; when I open the file with vi they show up.
X38888
No
No
No... (7 Replies)
Discussion started by: newbie2010
7 Replies
ctype(3C) ctype(3C)
NAME
ctype: isalnum(), isalpha(), isascii(), isblank(), iscntrl(), isdigit(), isgraph(), islower(), isprint(), ispunct(), isspace(), isupper(),
isxdigit() - classify characters according to type
SYNOPSIS
DESCRIPTION
These functions classify character-coded integer values according to the rules of the coded character set identified by the last successful
call to (see setlocale(3C)). Each function is a predicate returning nonzero for true, zero for false.
If has not been called successfully, characters are classified according to the rules of the default ASCII 7-bit coded character set (see
setlocale(3C)).
is defined on all integer values; the other functions are defined for the range (EOF) through
RETURN VALUE
The functions return nonzero under the following circumstances; zero otherwise:
c is an alphanumeric (letters or digits).
c is a letter.
c is any ASCII character code between 0 and 0177, inclusive.
c is a blank character; that is, a space or a tab.
c is a control character (in ASCII: character codes less than 040 and the delete character(0177)).
c is a decimal digit (in ASCII: characters [0-9]).
c is a visible character (in ASCII: printing characters, excluding the space character(040)).
c is a lowercase letter.
c is a printing character.
c is a punctuation character (in ASCII: any printing character except the space character(040), digits, letters).
c is a character that creates whitespace in displayed text (in ASCII: space, tab, carriage return, newline, verti-
cal tab, and formfeed).
c is an uppercase letter.
c is a hexadecimal digit (in ASCII: characters [0-9], [A-F] or [a-f]).
If the argument to any of these functions is outside the domain of the function, the result is undefined.
EXTERNAL INFLUENCES
Environment Variables
The category determines the classification of character type.
International Code Set Support
Single-byte character code sets are supported.
WARNINGS
These functions are supplied both as library functions and as macros defined in the header. Normally, the macro versions are used. To
obtain the library function, either use a to remove the macro definition or, if compiling in ANSI-C mode, enclose the function name in
parenthesis or take its address. The following example uses the library functions for and
AUTHOR
was developed by IBM, OSF, and HP.
SEE ALSO
setlocale(3C), ascii(5), thread_safety(5).
STANDARDS CONFORMANCE
ctype(3C)