09-29-2011
can anyone help
Can anyone give the entire code(using truncate) to achieve this please.
If any other solution also please let me know thanks.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
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)
Discussion started by: cursive
5 Replies
2. Shell Programming and Scripting
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)
Discussion started by: ospreyeagle
2 Replies
3. Shell Programming and Scripting
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)
Discussion started by: aristegui
4 Replies
4. Shell Programming and Scripting
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)
Discussion started by: Qwerty123
16 Replies
5. Shell Programming and Scripting
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)
Discussion started by: amio
2 Replies
6. Shell Programming and Scripting
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)
Discussion started by: mingming88
6 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 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)
Discussion started by: varun940
20 Replies
9. Shell Programming and Scripting
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)
Discussion started by: jao_madn
3 Replies
10. Shell Programming and Scripting
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 FREEBSD
truncate
TRUNCATE(1) BSD General Commands Manual TRUNCATE(1)
NAME
truncate -- truncate or extend the length of files
SYNOPSIS
truncate [-c] -s [+|-]size[K|k|M|m|G|g|T|t] file ...
truncate [-c] -r rfile file ...
DESCRIPTION
The truncate utility adjusts the length of each regular file given on the command-line.
The following options are available:
-c Do not create files if they do not exist. The truncate utility does not treat this as an error. No error messages are displayed and
the exit value is not affected.
-r rfile
Truncate or extend files to the length of the file rfile.
-s [+|-]size[K|k|M|m|G|g|T|t]
If the size argument is preceded by a plus sign (+), files will be extended by this number of bytes. If the size argument is pre-
ceded by a dash (-), file lengths will be reduced by no more than this number of bytes, to a minimum length of zero bytes. Other-
wise, the size argument specifies an absolute length to which all files should be extended or reduced as appropriate.
The size argument may be suffixed with one of K, M, G or T (either upper or lower case) to indicate a multiple of Kilobytes,
Megabytes, Gigabytes or Terabytes respectively.
Exactly one of the -r and -s options must be specified.
If a file is made smaller, its extra data is lost. If a file is made larger, it will be extended as if by writing bytes with the value zero.
If the file does not exist, it is created unless the -c option is specified.
Note that, while truncating a file causes space on disk to be freed, extending a file does not cause space to be allocated. To extend a file
and actually allocate the space, it is necessary to explicitly write data to it, using (for example) the shell's '>>' redirection syntax, or
dd(1).
EXIT STATUS
The truncate utility exits 0 on success, and >0 if an error occurs. If the operation fails for an argument, truncate will issue a diagnostic
and continue processing the remaining arguments.
SEE ALSO
dd(1), touch(1), truncate(2)
STANDARDS
The truncate utility conforms to no known standards.
HISTORY
The truncate utility first appeared in FreeBSD 4.2.
AUTHORS
The truncate utility was written by Sheldon Hearn <sheldonh@starjuice.net>.
BSD
December 19, 2006 BSD