09-28-2011
Removing trailing lines at the end of a text file
How do you remove trailing empty lines at the end of a text file? Thanks!
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I am currently confused.
Suppose I have a file something like the one below.
4299|raj Telecommunications|12|||||
4302|anjali International Ltd.|86|ritchie||dong|(000)2890 9993 |(222)4881 3689
4305|フィデュシアリ・ト-スト・インター...ショ...ル投資顧問株式会社 |112||||01-9211-1931 |08-3677-1985
Now... (2 Replies)
Discussion started by: rooh
2 Replies
2. Shell Programming and Scripting
Not sure why this thread was closed without any explanation, but you can do what you're asking with sed 's/]*$//g' < sourceFile > destFile (1 Reply)
Discussion started by: oombera
1 Replies
3. Shell Programming and Scripting
Here is my problem I'm hoping you guru's can help me figure out. I have a text file that contains comma delimited columns. What I'm looking to do is see if the 24th column on each row in the file contains a value (not null), and then write/append that line to a different file.
I've been... (4 Replies)
Discussion started by: WABonnett
4 Replies
4. Solaris
I have a text file with rows of information (it is basically a ls command information(o/p from ls command))
I need to remove the lines ending with a .cnt extension and keep the lines ending with .zip extension, how to accomplish this.
I also only need the date,size and name of the file from every... (2 Replies)
Discussion started by: ramky79
2 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I'm trying to remove multiple lines of text based off a series of different words and output it to a new file
The document contains a ton of data but i want to delete any line that has the following
mx1.rr.biz.com or ns2.ri.biz.com
i tried using grep -v filename "mx1.rr.biz.com" >... (3 Replies)
Discussion started by: spartan22
3 Replies
6. Shell Programming and Scripting
hello,
I go text file like this
E:/DDD/Dyndede/wwww
E:/DDD/sss.com/ffffg/fff
E:/DDD/vvvvvv/dd
E:/DDD/sss.com/bbbbbb
E:/DDD/sss.com/nnnn/xxI want to print
/alpha.jpg at the end of every lines like that
E:/DDD/Dyndede/wwww/alpha.jpg
E:/DDD/sss.com/ffffg/fff/alpha.jpg... (8 Replies)
Discussion started by: davidkhan
8 Replies
7. UNIX for Dummies Questions & Answers
I'm trying to remove all of the empty lines at the end of a Tab delimited file. They have no data just tabs.
I've tried may things, here are a couple:
sed /^\t.\t/d File1 > File2
sed /^\t{44}/d File1 > File2
What am I missing? (9 Replies)
Discussion started by: SirHenry1
9 Replies
8. UNIX for Dummies Questions & Answers
Hello All,
this is my first post so I don't know if I am doing this right.
I would like to append entries from a series of strings (contained in a text file) consecutively at the end of specifically labeled lines in another file.
As an example:
- the file that contains the values to be... (3 Replies)
Discussion started by: gus74
3 Replies
9. Shell Programming and Scripting
Hello.
I'm writing a script where every file you create will generate a md5sum and store it into a text file.
Say I create 2 files, it'll look like this in the text file:
d41d8cd98f00b204e9800998ecf8427e /helloworld/saystheman
d41d8cd98f00b204e9800998ecf8427e /helloworld/test
I... (3 Replies)
Discussion started by: batarangs_
3 Replies
10. Shell Programming and Scripting
I have a file similar to the below. I am selecting only the paragraphs with @inlineifset.
I am using the following command
sed '/@inlineifset/,/^ *$/!d;
s/@inlineifset{mrg, @btpar{@//' $flnm >> $ofln
This produces
@section Correlations between
seismograms,,,,}}
... (5 Replies)
Discussion started by: Danette
5 Replies
LEARN ABOUT MOJAVE
mime::field::conttype5.18
MIME::Field::ContType(3) User Contributed Perl Documentation MIME::Field::ContType(3)
NAME
MIME::Field::ContType - a "Content-type" field
DESCRIPTION
A subclass of Mail::Field.
Don't use this class directly... its name may change in the future! Instead, ask Mail::Field for new instances based on the field name!
SYNOPSIS
use Mail::Field;
use MIME::Head;
# Create an instance from some text:
$field = Mail::Field->new('Content-type',
'text/HTML; charset="US-ASCII"');
# Get the MIME type, like 'text/plain' or 'x-foobar'.
# Returns 'text/plain' as default, as per RFC 2045:
my ($type, $subtype) = split('/', $field->type);
# Get generic information:
print $field->name;
# Get information related to "message" type:
if ($type eq 'message') {
print $field->id;
print $field->number;
print $field->total;
}
# Get information related to "multipart" type:
if ($type eq 'multipart') {
print $field->boundary; # the basic value, fixed up
print $field->multipart_boundary; # empty if not a multipart message!
}
# Get information related to "text" type:
if ($type eq 'text') {
print $field->charset; # returns 'us-ascii' as default
}
PUBLIC INTERFACE
boundary
Return the boundary field. The boundary is returned exactly as given in the "Content-type:" field; that is, the leading double-hyphen
("--") is not prepended.
(Well, almost exactly... from RFC 2046:
(If a boundary appears to end with white space, the white space
must be presumed to have been added by a gateway, and must be deleted.)
so we oblige and remove any trailing spaces.)
Returns the empty string if there is no boundary, or if the boundary is illegal (e.g., if it is empty after all trailing whitespace has
been removed).
multipart_boundary
Like "boundary()", except that this will also return the empty string if the message is not a multipart message. In other words,
there's an automatic sanity check.
type
Try real hard to determine the content type (e.g., "text/plain", "image/gif", "x-weird-type", which is returned in all-lowercase.
A happy thing: the following code will work just as you would want, even if there's no subtype (as in "x-weird-type")... in such a
case, the $subtype would simply be the empty string:
($type, $subtype) = split('/', $head->mime_type);
If the content-type information is missing, it defaults to "text/plain", as per RFC 2045:
Default RFC 2822 messages are typed by this protocol as plain text in
the US-ASCII character set, which can be explicitly specified as
"Content-type: text/plain; charset=us-ascii". If no Content-Type is
specified, this default is assumed.
Note: under the "be liberal in what we accept" principle, this routine no longer syntax-checks the content type. If it ain't empty,
just downcase and return it.
NOTES
Since nearly all (if not all) parameters must have non-empty values to be considered valid, we just return the empty string to signify
missing fields. If you need to get the real underlying value, use the inherited "param()" method (which returns undef if the parameter is
missing).
SEE ALSO
MIME::Field::ParamVal, Mail::Field
AUTHOR
Eryq (eryq@zeegee.com), ZeeGee Software Inc (http://www.zeegee.com). David F. Skoll (dfs@roaringpenguin.com) http://www.roaringpenguin.com
perl v5.18.2 2013-11-14 MIME::Field::ContType(3)