can u help me out to print last two words of each sentence of a file.
for example.
contents of input file:
i love songs
my favourite songs
sent
songs all kind
good buddy
Ouput file should contain:
love songs
favourite songs
sent
all kind
good buddy (5 Replies)
hi
i have a line
"abc,def,ghi,abc,def ,ghi,abc,def,ghi,abc,def ,ghi,abc,def,ghi,abc"
I want to print the no of words, words separated by comma
please help (3 Replies)
Hi, im having a problem with xargs, i want to cout word of each line in file, and i HAVE to use xargs, i tried:
cat file | xargs wc -w .....that uses all words in file like name of files and passed then to wc so it worte wc :somewordformfile is not i afile or directory
cat file | xargs -I{} wc... (3 Replies)
Hi experts
I need to pick 2 matched words from the same line.....
I have given below an example file
eg:
O14757 hsa04110 hsa04115 2 P38398 hsa04120 1
O15111 hsa04010 hsa04210 hsa04920 hsa04620 hsa04660 hsa04662 hsa05200 hsa05212 hsa05221 hsa05220 hsa05215 hsa05222 hsa05120 13 O14920... (4 Replies)
I would like to cut words based on the word count of a line. This over here inspired me with some ideas but I wasn't able to get what I needed.
https://www.unix.com/shell-programming-scripting/105841-count-words-each-line-file-using-xargs.html
If the line has 6 words I would like to use this.... (8 Replies)
Hi,
Please suggest a way to print number of words in the end of each line.
<input file>
red aunt house
blue sky
bat and ball game
<output file>
red aunt house 3
blue sky 2
bat and ball game 4
Thanks! (2 Replies)
Hi all,
I have a file in which each string from column 1 is associated with one or multiple strings from column 2. For an example, in the sample input below, Gene1 from column1 is associated with two different strings from column 2 (BP1 and BP2).For every unique string from column 1, I need to... (9 Replies)
Hi Folks :)
I have a .txt file with thousands of words. I'm trying to sort the lines in order based on number of words per line.
Example
from:
word
word word word
word word
word word word word
word
word word word
word word
to desired output:
word (2 Replies)
Discussion started by: martinsmith
2 Replies
LEARN ABOUT SUSE
modperl::code
ModPerl::Code(3) User Contributed Perl Documentation ModPerl::Code(3)NAME
$class::Const - Perl Interface for $class Constants
SYNOPSIS CONSTANTS
EOF
my $groups = $data{$class};
for my $group (sort keys %$groups) {
print $fh <<"EOF";
":$group"
use $class::Const -compile qw(:$group);
The ":$group" group is for XXX constants.
EOF
for my $const (sort @{ $groups->{$group} }) {
print $fh "=head3 C<$class::$const>
";
}
}
print $fh "=cut
";
}
}
sub generate_constants_lookup_doc {
my ($data) = @_;
while (my ($class, $groups) = each %$Apache2::ConstantsTable) {
my $constants = [map { @$_ } values %$groups];
constants_lookup_code_doc($constants, $class, $data);
}
}
sub generate_constants_group_lookup_doc {
my ($data) = @_;
while (my ($class, $groups) = each %$Apache2::ConstantsTable) {
constants_group_lookup_code_doc($class, $groups, $data);
}
}
sub constants_group_lookup_code_doc {
my ($class, $groups, $data) = @_;
my @tags;
my @code;
while (my ($group, $constants) = each %$groups) {
$data->{$class}{$group} = [
map {
my @ifdef = constants_ifdef($_);
s/^($constant_prefixes)_?//o;
$seen_const{$class}{$_}++;
$_;
} @$constants
];
}
}
sub constants_lookup_code_doc {
my ($constants, $class, $data) = @_;
my (%switch, %alias);
%alias = %shortcuts;
my $postfix = lc $class;
my $package = $class . '::';
my $package_len = length $package;
my $func = canon_func(qw(constants lookup), $postfix);
for (@$constants) {
if (s/^($constant_prefixes)(_)?//o) {
$alias{$_} = join $2 || "", $1, $_;
}
else {
$alias{$_} ||= $_;
}
next unless /^([A-Z])/;
push @{ $switch{$1} }, $_;
}
for my $key (sort keys %switch) {
my $names = $switch{$key};
for my $name (@$names) {
my @ifdef = constants_ifdef($alias{$name});
push @{ $data->{$class}{other} }, $name
unless $seen_const{$class}{$name}
}
}
}
sub generate_exports {
my ($self, $c_fh) = @_;
require ModPerl::WrapXS;
ModPerl::WrapXS->generate_exports($c_fh); }
# src/modules/perl/*.c files needed to build APR/APR::* outside # of mod_perl.so sub src_apr_ext {
return map { "modperl_$_" } (qw(error bucket),
map { "common_$_" } qw(util log)); }
1; __END__
NAME
ModPerl::Code - Generate mod_perl glue code
SYNOPSIS
use ModPerl::Code ();
my $code = ModPerl::Code->new;
$code->generate;
DESCRIPTION
This module provides functionality for generating mod_perl glue code. Reason this code is generated rather than written by hand include:
consistency
thin and clean glue code
enable/disable features (without #ifdefs)
adapt to changes in Apache
experiment with different approaches to gluing
AUTHOR
Doug MacEachern
perl v5.12.1 2007-12-31 ModPerl::Code(3)