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... (5 Replies)
I use SAS (a statistical software) and have to remove last character or the last 1/2 numbers that appear after characters from the string using Perl Regular Expression (which is recognized by SAS).
Input: f183ii10 f183ii2 f182ii1 f182ii2 f183iim f22ii f22ii11 f22ii12 pmh4 pmhm
Desired... (2 Replies)
Hello, i'm unable to remove the parenthesis character.
With $parsed_AsciiName =~ s/\(//;
the string is the same
And with $parsed_AsciiName =~ s/(//;
i retrieve "Unmatched ( in regex; marked by <-- HERE in m/( <-- HERE"
Any ideas, please? thank you in advanced. (4 Replies)
Hi All,
How to remove a box like special character which appears at the end of a string/line/record. I have no clue what this box like special character is. It is transparent square like box. This appears in a .DAT file at the end of header.
I'm to compare a value in header with a parameter.... (16 Replies)
Hi All,
I have named a file with current date,time and year as follows:
month=`date | awk '{print $2}'`
date=`date | awk '{print $3}'`
year=`date | awk '{print $6}'`
time=`date +%Hh_%Mm_%Ss'`
filename="test_"$month"_"$date"_"$year"_"$time".txt"
> $filename
The file is created with a... (2 Replies)
i want to split the input by a space and remove specific characters like full stop, comma...... etc. and then save each word in an array.
i got something below, but it didn't work. can anyone please help me?
Thank you
#!/usr/bin/perl -w
while (<>)
{
$line = <>;
@word = split(' ',... (6 Replies)
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)
I need to remove new line character from end of file.
Suppose here are content.
a|b|c|d|r
a|b|c|d|r
a|b|c|d|r
<new line>
that means file contains 4 lines but data is there in 3 lines.
so I want that only 3 lines should be there in file.
Please help (20 Replies)
Hi,
I hope someone can share there scripting fu on my problem,
I would like to delete the 3rd character from a random length of string starting from the end
Example
Output
Hope you can help me..
Thanks in advance.. (3 Replies)
how to Remove comma as last charector in end of last line of file:
example:
input file
---------------
aaaaaa,
bbbbbb,
cccc,
12345,
____________
output file :
-----------
aaaaaa,
bbbbbb, (6 Replies)
Discussion started by: RahulJoshi
6 Replies
LEARN ABOUT ULTRIX
ftruncate
truncate(2) System Calls Manual truncate(2)Name
truncate, ftruncate - truncate a file to a specified length
Syntax
truncate(path, length)
char *path;
int length;
ftruncate(fd, length)
int fd, length;
Description
The system call causes the file named by path or referenced by fd to be truncated to, at most, length bytes in size. If the file previ-
ously was larger than this size, the extra data is lost. With the file must be open for writing.
Return Values
A value of zero (0) is returned if the call succeeds. If the call fails, a -1 is returned, and the global variable errno specifies the
error.
Restrictions
Partial blocks discarded as the result of truncation are not zero-filled. This can result in holes in files that do not read as zero.
Diagnostics
The system call succeeds unless:
[ENOTDIR] A component of the path prefix is not a directory.
[ENOENT] The named file does not exist.
[EACCES] Search permission is denied for a component of the path prefix.
[EISDIR] The named file is a directory.
[EROFS] The named file resides on a read-only file system.
[ETXTBSY] The file is a pure procedure (shared text) file that is being executed.
[EFAULT] The path points outside the process's allocated address space.
[ENAMETOOLONG] A component of a pathname exceeded 255 characters, or an entire path name exceeded 1023 characters.
[ELOOP] Too many symbolic links were encountered in translating the pathname.
[EIO] An I/O error occurred updating the inode.
The system call succeeds unless:
[EBADF] The fd is not a valid descriptor.
[EINVAL] The fd references a socket, not a file.
[ETIMEDOUT] A connect request or remote file operation failed, because the connected party did not properly respond after a period of
time that is dependent on the communications protocol.
See Alsoopen(2)truncate(2)