Can someone help me on this. I have a file that has a long line just like below. The long line keeps on being truncated to the next line (new line + space) for some reason. Basically, I just need to remove this problem. Hope somebody can help! Thanks!
Hello,
I am currently trying to edit an ldif file. The ldif specification states that a newline followed by a space indicates the subsequent line is a continuation of the line. So, in order to search and replace properly and edit the file, I open the file in textwrangler, search for "\r " and... (14 Replies)
Input:
--------------------------
123asd 456sdasda 789a
-------------------------
output wanted:
---------------------
123asd
456sdasda
789a
----------------------
I want this by sed in simple way
please help (I know by: tr ' ' '\n' < inputfile )I want it by sed only (5 Replies)
Hi Guys,
I have a file with content as below
aj.txt
"Iam
allfine" abcdef
abcd "all is
not well"
What I'm trying to say is my data has some new line characters in between quoted text. I must get ride of the newline character that comes in between the quoted text.
output must be:... (8 Replies)
I created a awk state to calculate the number of success however when the query runs it has a leading zero. Any ideas on how to remove the leading zero from the calculation?
Here is my query:
cat myfile.log | grep | awk '{print $2,$3,$7,$11,$15,$19,$23,$27,$31,$35($19/$15*100)}'
02:00:00... (1 Reply)
I am having a peculiar problem. First I run the code below to append 0 at the start of each line in some hundreds of files that I have in a directory. These files have each word in a newline.
for f in *.dat; do
echo "0" > tmpfile
cat $f >> tmpfile
mv tmpfile $f
done
Then I run this... (7 Replies)
Hello
I have had a requirement where I need to move data to a new line based on a text .So basically as soon as it encounters :61: it should move to a new line
Source Data :
:61:D100,74NCH1 :61:D797,50NCH2 :61:D89,38NCHK2 :61:D99,38NCHK12 :61:D79,38NCHK22 :61:D29,38NCHK5
Target Data... (11 Replies)
I'm trying to print out integers and space/newline for a nicer output, for example, every 20 integers in a row with ternary operator.
In C I could do it with:printf("%d%s",tmp_int, ((j+1)%20) ? "\t":"\n"); but could not figure out the equivalent in C++:
cout << ((j+1)%20)?... (4 Replies)
Discussion started by: yifangt
4 Replies
LEARN ABOUT XFREE86
boolean
boolean(3pm) User Contributed Perl Documentation boolean(3pm)NAME
boolean - Boolean support for Perl
SYNOPSIS
use boolean;
do &always if true;
do &never if false;
do &maybe if boolean($value)->isTrue;
and:
use boolean ':all';
$guess = int(rand(2)) % 2 ? true : false;
do &something if isTrue($guess);
do &something_else if isFalse($guess);
and:
use boolean -truth;
die unless ref(42 == 42) eq 'boolean';
die unless ("foo" =~ /bar/) eq '0';
DESCRIPTION
Most programming languages have a native "Boolean" data type. Perl does not.
Perl has a simple and well known Truth System. The following scalar values are false:
$false1 = undef;
$false2 = 0;
$false3 = 0.0;
$false4 = '';
$false5 = '0';
Every other scalar value is true.
This module provides basic Boolean support, by defining two special objects: "true" and "false".
RATIONALE
When sharing data between programming languages, it is important to support the same group of basic types. In Perlish programming
languages, these types include: Hash, Array, String, Number, Null and Boolean. Perl lacks native Boolean support.
Data interchange modules like YAML and JSON can now "use boolean" to encode/decode/roundtrip Boolean values.
FUNCTIONS
This module defines the following functions:
true
This function returns a scalar value which will evaluate to true. The value is a singleton object, meaning there is only one "true"
value in a Perl process at any time. You can check to see whether the value is the "true" object with the isTrue function described
below.
false
This function returns a scalar value which will evaluate to false. The value is a singleton object, meaning there is only one "false"
value in a Perl process at any time. You can check to see whether the value is the "false" object with the isFalse function described
below.
boolean($scalar)
Casts the scalar value to a boolean value. If $scalar is true, it returns "boolean::true", otherwise it returns "boolean::false".
isTrue($scalar)
Returns "boolean::true" if the scalar passed to it is the "boolean::true" object. Returns "boolean::false" otherwise.
isFalse($scalar)
Returns "boolean::true" if the scalar passed to it is the "boolean::false" object. Returns "boolean::false" otherwise.
isBoolean($scalar)
Returns "boolean::true" if the scalar passed to it is the "boolean::true" or "boolean::false" object. Returns "boolean::false"
otherwise.
METHODS
Since true and false return objects, you can call methods on them.
$boolean->isTrue
Same as isTrue($boolean).
$boolean->isFalse
Same as isFalse($boolean).
USE OPTIONS
By default this module exports the "true", "false" and "boolean" functions.
The module also defines these export tags:
:all
Exports "true", "false", "boolean", "isTrue", "isFalse", "isBoolean"
-truth
You can specify the "-truth" option to override truth operators to return "boolean" values.
use boolean -truth;
print ref("hello" eq "world"), "
";
Prints:
boolean
"-truth" can be used with the other import options.
AUTHOR
Ingy doet Net <ingy@cpan.org>
COPYRIGHT
Copyright (c) 2007, 2008, 2010, 2011. Ingy doet Net.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html
perl v5.12.4 2011-09-12 boolean(3pm)