05-14-2013
9 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
I am looking for a guide on how to program for either the Linux or FreeBSD (includes 4.4BSD, NetBSD or OpenBSD) kernel. I would prefer to learn how to write device drivers, but anything would help.
If you know, please email me at *removed* or leave a post here
Regards,
Farhan (0 Replies)
Discussion started by: Farhan
0 Replies
2. UNIX for Dummies Questions & Answers
Ok, so I'm trying to finalize my understanding of read/write and kernel interaction.
read():
You have a library function that has as it's first parameter (what the open file to read from is), second parameter( a pointer to a buffer (is this the location of a buffer in the user area or the... (1 Reply)
Discussion started by: Krothos
1 Replies
3. Programming
Ok, so I'm trying to finalize my understanding of read/write and kernel interaction.
read():
You have a library function that has as it's first parameter (what the open file to read from is), second parameter( a pointer to a buffer (is this the location of a buffer in the user area or the... (7 Replies)
Discussion started by: Krothos
7 Replies
4. IP Networking
Hi,
We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Discussion started by: swatidas11
1 Replies
5. Solaris
Hi gurus
Could anybody tell me which file is read by kernel to set its default system kernal parameters values in solaris. Here I am not taking about /etc/system file which is used to load kernal modules or to change any default system kernal parameter value
Is it /dev/kmem file or something... (1 Reply)
Discussion started by: girish.batra
1 Replies
6. Fedora
I have been reading prep questions for my second unix academy exam, and there's a nuance, I'm not sure I understand it correctly.
I've been under impression from my readings of book by Evi Nemeth and from unix academy DVDs I've been watching, that kernel's modules are drivers. I think of it, as... (25 Replies)
Discussion started by: newlinuxuser1
25 Replies
7. Shell Programming and Scripting
Hello,
I am trying to find out how I can find the tty number of a terminal a bash script has just created.
Ultimately what I am trying to achieve is a script that starts a new terminal where stderr can be directed to.
ls -l missing_file 2> /dev/pts/X
To find the tty number of the... (3 Replies)
Discussion started by: colinireland
3 Replies
8. BSD
I have an old hppa workstation install Openbsd on it,suppose
i want to use bktr driver on it,i see bktr is configured on some archs(amd64,i386,ppc) but not on hppa,can i use
the bktr driver line from amd64 or i386 in Generic kernel or custom kernel config? (3 Replies)
Discussion started by: Linusolaradm1
3 Replies
9. UNIX for Beginners Questions & Answers
I am relatively new to 'older unix' systems but I am hoping someone can help me with the error I am seeing on my box. We have an Irix 6.5 running. Our computer keeps restarting (crashed once) itself, by itself, at random points in the last 5 out of 8 sessions. This is the sys log, that i took a... (0 Replies)
Discussion started by: pmccpete
0 Replies
LEARN ABOUT DEBIAN
text::trim
Text::Trim(3pm) User Contributed Perl Documentation Text::Trim(3pm)
NAME
Text::Trim - remove leading and/or trailing whitespace from strings
VERSION
version 1.02
SYNOPSIS
use Text::Trim;
$text = " important data
";
$data = trim $text;
# now $data contains "important data" and $text is unchanged
# or:
trim $text; # work in-place, $text now contains "important data"
@lines = <STDIN>;
rtrim @lines; # remove trailing whitespace from all lines
# Alternatively:
@lines = rtrim <STDIN>;
# Or even:
while (<STDIN>) {
trim; # Change $_ in place
# ...
}
DESCRIPTION
This module provides functions for removing leading and/or trailing whitespace from strings. It is basically a wrapper around some simple
regexes with a flexible context-based interface.
EXPORTS
All functions are exported by default.
CONTEXT HANDLING
void context
Functions called in void context change their arguments in-place
trim(@strings); # All strings in @strings are trimmed in-place
ltrim($text); # remove leading whitespace on $text
rtrim; # remove trailing whitespace on $_
No changes are made to arguments in non-void contexts.
list context
Values passed in are changed and returned without affecting the originals.
@result = trim(@strings); # @strings is unchanged
@result = rtrim; # @result contains rtrimmed $_
($result) = ltrim(@strings); # like $result = ltrim($strings[0]);
scalar context
As list context but multiple arguments are stringified before being returned. Single arguments are unaffected. This means that under
these circumstances, the value of $" ($LIST_SEPARATOR) is used to join the values. If you don't want this, make sure you only use single
arguments when calling in scalar context.
@strings = (" hello
", " there
");
$trimmed = trim(@strings);
# $trimmed = "hello there"
local $" = ', ';
$trimmed = trim(@strings);
# Now $trimmed = "hello, there"
$trimmed = rtrim;
# $trimmed = $_ minus trailing whitespace
Undefined values
If any of the functions are called with undefined values, the behaviour is in general to pass them through unchanged. When stringifying a
list (calling in scalar context with multiple arguments) undefined elements are excluded, but if all elements are undefined then the return
value is also undefined.
$foo = trim(undef); # $foo is undefined
$foo = trim(undef, undef); # $foo is undefined
@foo = trim(undef, undef); # @foo contains 2 undefined values
trim(@foo) # @foo still contains 2 undefined values
$foo = trim('', undef); # $foo is ''
FUNCTIONS
trim
Removes leading and trailing whitespace from all arguments, or $_ if none are provided.
rtrim
Like trim() but removes only trailing (right) whitespace.
ltrim
Like trim() but removes only leading (left) whitespace.
UNICODE
Because this module is implemented using perl regular expressions, it is capable of recognising and removing unicode whitespace characters
(such as non-breaking spaces) from scalars with the utf8 flag on. See Encode for details about the utf8 flag.
Note that this only applies in the case of perl versions after 5.8.0 or so.
SEE ALSO
Brent B. Powers' String::Strip performs a similar function in XS.
AUTHOR
Matt Lawrence <mattlaw@cpan.org>
ACKNOWLEDGEMENTS
Terrence Brannon <metaperl@gmail.com> for bringing my attention to String::Strip and suggesting documentation changes.
perl v5.10.1 2010-06-07 Text::Trim(3pm)