Hi all.
I have 2 files like this:
f1
A 10
B 80
C 9
f2
A 11
B 700
C 10
What I want is the concatenation of the two files sorted by name (alphabetically) and size (numerically), so the result should be like this:
F3 (cat f1 f2 sorted)
A 10
A 11
B 80
B 700 (2 Replies)
I got a long list of file name.
My input:
data_1.txt
data_2.txt
data_3.txt
data_10.txt
data_21.txt
data_12.txt
data_4.txt
My desired output:
data_1.txt
data_2.txt
data_3.txt
data_4.txt
data_10.txt
data_12.txt
data_21.txt
Does anybody got idea how to archive it? (11 Replies)
So, I will be working with someone and basically we are trying to build a form that is submitted most likely via the web and the data is just a string of numbers.
like:
19383882872201110929282821818182827349190102837364718191001932873711
Now, each number is part of a numerical value of... (4 Replies)
Hi,
A basic query. In the example file below, I want to sort by column 1 and then by column 2 numerically. I have tried sort -k2n,1 file1 but while this sorts the columns in the correct order, it does not sort column 2 numerically. Any help would be much appreciated. Also, if you have time to... (3 Replies)
Greetings - I'm not necessarily new to bash scripting - I'm probably between beginner and intermediate, but I have something that I just cannot figure out after many attempts to find it. I have a file that is merely a list of many files, with their respective paths, and a branch path (ClearCase)... (5 Replies)
I have a column of numbers in the following format:
1.722e-05
2.018e-05
2.548e-05
2.747e-05
7.897e-05
4.016e-05
4.613e-05
4.613e-05
5.151e-05
5.151e-05
5.151e-05
6.1e-05
6.254e-05
7.04e-05
7.12e-05
7.12e-05 (6 Replies)
Hello all,
I have a list of file names in a text document where each file name consists of 4 letters and 3 numbers (for example MACR119). There are 48 file names in the document (they are not in alphabetical or numerical order). I would like to reorder the list of names so that the 48th name is... (3 Replies)
How to sort the following output based on lowest to highest BE?
The following sort does not work.
$ sort -t. -k1,1n -k2,2n bfd.txt
BE31.116 0s 0s DOWN DAMP
BE31.116 0s 0s DOWN DAMP
BE31.117 0s 0s ... (7 Replies)
Trying to sort a bunch of files numerically but can't seem to get the command just right. This is in a IBM AIX machine.
I have a directory that has...
backup.bk1
backup.bk100
backup.bk2
backup.bk200
backup.bk3
backup.bk300
There are a lot more files but this is shortened for the... (5 Replies)
Perl::Critic::Policy::RegularExpressions::ProhibitFixedSUsergContributed PePerl::Critic::Policy::RegularExpressions::ProhibitFixedStringMatches(3)NAME
Perl::Critic::Policy::RegularExpressions::ProhibitFixedStringMatches - Use "eq" or hash instead of fixed-pattern regexps.
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
A regular expression that matches just a fixed set of constant strings is wasteful of performance and is hard on maintainers. It is much
more readable and often faster to use "eq" or a hash to match such strings.
# Bad
my $is_file_function = $token =~ m/A (?: open | close | read ) z/xms;
# Faster and more readable
my $is_file_function = $token eq 'open' ||
$token eq 'close' ||
$token eq 'read';
For larger numbers of strings, a hash is superior:
# Bad
my $is_perl_keyword =
$token =~ m/A (?: chomp | chop | chr | crypt | hex | index
lc | lcfirst | length | oct | ord | ... ) z/xms;
# Better
Readonly::Hash my %PERL_KEYWORDS => map {$_ => 1} qw(
chomp chop chr crypt hex index lc lcfirst length oct ord ...
);
my $is_perl_keyword = $PERL_KEYWORD{$token};
Conway also suggests using "lc()" instead of a case-insensitive match.
VARIANTS
This policy detects both grouped and non-grouped strings. The grouping may or may not be capturing. The grouped body may or may not be
alternating. "A" and "z" are always considered anchoring which "^" and "$" are considered anchoring is the "m" regexp option is not in
use. Thus, all of these are violations:
m/^foo$/;
m/A foo z/x;
m/A foo z/xm;
m/A(foo)z/;
m/A(?:foo)z/;
m/A(foo|bar)z/;
m/A(?:foo|bar)z/;
Furthermore, this policy detects violations in "m//", "s///" and "qr//" constructs, as you would expect.
CONFIGURATION
This Policy is not configurable except for the standard options.
CREDITS
Initial development of this policy was supported by a grant from the Perl Foundation.
AUTHOR
Chris Dolan <cdolan@cpan.org>
COPYRIGHT
Copyright (c) 2007-2011 Chris Dolan. Many rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license
can be found in the LICENSE file included with this module
perl v5.16.32014-06Perl::Critic::Policy::RegularExpressions::ProhibitFixedStringMatches(3)