I have a variable which consists of a string like this:
001 aaabc 44 a bbb12
How do I extract each substring, delimited by the spaces, into new variables - one for each substring?
eg var1 will be 001, var2 will be aaabc, var3 will be 44, var4 will be a, etc?
I've come up with this:... (2 Replies)
hi,I am new to shell script,I have String,like this:
Number of rows exported: 5321
the numbe at end could changing,how can I extract this number and assign it to a variable,then use it later in script.
thanks. (19 Replies)
Hello,
I'm running calculations and I need to extract a specific number from a output file. So far I've only been able to GREP entire lines containing the string: '1 F=' . I would like to go a step further and extract just the number following '1 F='. The entire line looks like:
1 F=... (10 Replies)
Hi, guys. I have one question:
I need to search for a string in a file, and then extract another string from the file and assign it to a variable.
For example:
the contents of the file (group) is below:
...
ftp:x:23:
mail:x:34
...
testing:x:2001
sales:x:2002
development:x:2003
...... (6 Replies)
I need to extract certain pieces from a string, wher delimiters may vary. For example
A0 B0 C0 12345677 X0 Y0 Z0
A1-B1 C1 12345678 X1 Y0 Z0
A1/B2 C77 12345679 X2 Y0 Z0
I need to get
C0 12345677 X0
C1 12345678 X1
C77 12345679 X2
I tried sed, see example below:
echo 'A0 B0... (2 Replies)
Hi,
I have a FTP script which gets called from a wrapper script that exports a variable having value as:
"/export/home/dips/logs/dipsSFTP_file1.log.YYYYMMDDHHMISS". I want to extract the file name "dipsSFTP_file1.log.YYYYMMDDHHMISS" and the dir path "/export/home/dips/logs/" from this... (4 Replies)
continuing from my previous post, whose link is given below as a reference
https://www.unix.com/shell-programming-scripting/171076-shell-scripting.html#post302573569
consider there is create table commands in a file for eg:
CREATE TABLE `Blahblahblah` (
`id` int(11) NOT NULL... (2 Replies)
I have a file with
<suit:run date="Trump Tue 06/19/2012 11:41 AM EDT" machine="garg-ln" build="19921" level="beta" release="6.1.5" os="Linux">
Need to find word "build" then
extract build number, which is 19921 also
release number, which is 6.1.5 then
concatenate them to one variable as... (6 Replies)
Need Assistance in shell programming... I have a huge file which has multiple stations and i wanted to search particular station and extract few lines from it and the rest is not needed
Bold letters are the stations . The whole file has multiple stations .
Below example i wanted to search... (4 Replies)
Perl::Critic::Policy::ValuesAndExpressions::RequireConstUsereContributed PePerl::Critic::Policy::ValuesAndExpressions::RequireConstantVersion(3pm)NAME
Perl::Critic::Policy::ValuesAndExpressions::RequireConstantVersion - Require $VERSION to be a constant rather than a computed value.
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
The $VERSION variable of a module should be a simple constant - either a number, a single-quotish string, or a 'use version' object. In the
latter case the 'use version;' must appear on the same line as the object construction.
Computing the version has problems of various severities.
The most benign violation is computing the version from (e.g.) a Subversion revision number:
our ($VERSION) = q$REVISION: 42$ =~ /(d+)/;
The problem here is that the version is tied to a single repository. The code can not be moved to another repository (even of the same
type) without changing its version, possibly in the wrong direction.
This policy accepts v-strings ("v1.2.3" or just plain 1.2.3), since these are already flagged by
Perl::Critic::Policy::ValuesAndExpressions::ProhibitVersionStrings.
CONFIGURATION
The proper way to set a module's $VERSION to a "version" object is to "use version;" on the same line of code that assigns the value of
$VERSION. That way, ExtUtils::MakeMaker and Module::Build can extract the version when packaging the module for CPAN. By default, this
policy declares an error if this is not done.
Should you wish to allow version objects without loading the version module on the same line, add the following to your configuration file:
[ValuesAndExpressions::RequireConstantVersion]
allow_version_without_use_on_same_line = 1
CAVEATS
There will be false negatives if the $VERSION appears on the left-hand side of a list assignment that assigns to more than one variable, or
to "undef".
There may be false positives if the $VERSION is assigned the value of a here document. This will probably remain the case until
PPI::Token::HereDoc acquires the relevant portions of the PPI::Token::Quote interface.
There will be false positives if $VERSION is assigned the value of a constant created by the Readonly module or the constant pragma,
because the necessary infrastructure appears not to exist, and the author of the present module lacked the knowledge/expertise/gumption to
put it in place.
Currently the idiom
our $VERSION = '1.005_05';
$VERSION = eval $VERSION;
will produce a violation on the second line of the example.
AUTHOR
Thomas R. Wyant, III wyant at cpan dot org
COPYRIGHT
Copyright (c) 2009-2011 Tom Wyant.
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.14.22012-06Perl::Critic::Policy::ValuesAndExpressions::RequireConstantVersion(3pm)