08-16-2017
Quote:
Originally Posted by
jim mcnamara
The one is a boolean (truth) value. It means print this line. So the command removes the first field then prints what is left.
Is it possible to rewrite this code without 1? (using something like print)
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Folks:
I have a file which has 3 columns. Using awk I want to remove rows from column 3 (Col3 <> A) where it is not equal to A. All columns are seperated by "|".
Col1|Col2|Col3|Col4
1 | 2 | A | 4
2 | 3 | A | 5
3 | 4 | B | 6
4 | 5 | A | 7
5 | 6 | ... (3 Replies)
Discussion started by: pr2003
3 Replies
2. Shell Programming and Scripting
I have a text file
Nov 1 LOG_10_000000343.gzip_COMPLETE 2910 server.log.3
Nov 4 LOG_10_000000343.gzip_COMPLETE 2910 server.log.4
Dec 5 LOG_10_000000343.gzip_blah 2910 server.log.5
Jul 6 LOG_10_000000343.gzip_ERROR 2910 server.log.1
I need to convert this to
Nov 1 LOG_10_000000343.gzip... (3 Replies)
Discussion started by: gubbu
3 Replies
3. Shell Programming and Scripting
Hi All,
How to remove col1 and last column in a line. Please suggest some awk stuffs.
Input
col1 col2 col3 col4
col1 col2 col3 col4 col5
col1 col2 col3 col4
col1 col2 col3
Output
Processing col2 col3 ...
Processing col2 col3 col4 ...
Processing col2 col3 ...
Processing... (5 Replies)
Discussion started by: k_manimuthu
5 Replies
4. Shell Programming and Scripting
Given a file such as this I need to remove the duplicates.
00060011 PAUL BOWSTEIN ad_waq3_921_20100826_010517.txt
00060011 PAUL BOWSTEIN ad_waq3_921_20100827_010528.txt
0624-01 RUT CORPORATION ad_sade3_10_20100827_010528.txt
0624-01 RUT CORPORATION ... (13 Replies)
Discussion started by: script_op2a
13 Replies
5. Shell Programming and Scripting
Hi all,
I want to remove the remove bracket sign ( ) and put in the separate column I also want to remove the repeated entry like in first row in below input (PA156) is repeated
ESR1 (PA156) leflunomide (PA450192) (PA156) leflunomide (PA450192)
CHST3 (PA26503) docetaxel... (2 Replies)
Discussion started by: manigrover
2 Replies
6. Shell Programming and Scripting
Hi,
I would like to ask your expertise to remove specific column no. 8 in the below file using but I don't have an idea on how to simply do this using awk command. Appreciate your help in advance.
Input f:
ABC 1 1XC
CDA 1 2YC
CCC 1 3XC
AVD 1 3XA
Expected output file:
ABC 1 1C
CDA... (9 Replies)
Discussion started by: zzavilz
9 Replies
7. Shell Programming and Scripting
hi all,
how can i use grep or awk to clean the following input data:
n<>the<>96427210 861521305 123257583
n<>obj<>79634223 861521305 79634223
n<>nmod<>68404733 861521305 68422718
where the desired results is to remove all non-numeric characters?:
96427210 861521305 123257583 ... (5 Replies)
Discussion started by: owwow14
5 Replies
8. Shell Programming and Scripting
(14 Replies)
Discussion started by: dhruuv369
14 Replies
9. Shell Programming and Scripting
I need to remove specific column to one range
source file
3 1 000123456
2 2 000123569
3 3 000123564
12 000123156
15 000125648
128 000125648
Output required
3 000123456
2 000123569
3 000123564
12 000123156
15 000125648
128 000125648 (6 Replies)
Discussion started by: ranjancom2000
6 Replies
LEARN ABOUT CENTOS
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)