By replacing a line with a certain number of hyphens with a word i can easily parse. Like, in the following (simplified, just proof-of-concept) example:
In practice one could replace a certain destination directory for every given numbers of hyphens so that one could directly use that in the following mv-statement instead of the rather cumbersome case-esac.
Hi Friends,
Can any of you explain me about the below line of code?
mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`
Im not able to understand, what exactly it is doing :confused:
Any help would be useful for me.
Lokesha (4 Replies)
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
strange :)
can you tell why?:cool:
#!/bin/bash
echo " enter your age "
read age
if ; then
echo " you do not have to pay tax "
elif ]; then
echo " you are eligible for income tax "
else
echo " you dont have to pay tax "
fi (3 Replies)
Hi ,
i have some files of specific pattern ...i need to look for files which are having size greater than zero and move those files to another directory..
Ex...
abc_0702,
abc_0709,
abc_782
abc_1234 ...etc
need to find out which is having the size >0 and move those to target directory..... (7 Replies)
I have a bunch of random character lines like ABCEDFG. I want to find all lines with "A" and then change any "E" to "X" in the same line. ALL lines with "A" will have an "X" somewhere in it. I have tried sed awk and vi editor. I get close, not quite there. I know someone has already solved this... (10 Replies)
How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address
and column 3 contains “cc” e-mail address to include with same email.
Sample input file, email.txt
Below is an sample code where... (2 Replies)
Okay, so I have a rather large text file and will have to process many more and this will save me hours of work.
I'm not very good at scripting, so bear with me please.
Working on Linux RHEL
I've been able to filter and edit and clean up using sed, but I have a problem with moving lines.
... (9 Replies)
Hi everybody,
I am new at Unix/Bourne shell scripting and with my youngest experiences, I will not become very old with it :o
My code:
#!/bin/sh
set -e
set -u
export IFS=
optl="Optl"
LOCSTORCLI="/opt/lsi/storcli/storcli"
($LOCSTORCLI /c0 /vall show | grep RAID | cut -d " "... (5 Replies)
Hello.
System : opensuse leap 42.3
I have a bash script that build a text file.
I would like the last command doing :
print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt
where :
print_cmd ::= some printing... (1 Reply)
Hi 2 all,
i have had AIX 7.2
:/# /usr/IBMAHS/bin/apachectl -v
Server version: Apache/2.4.12 (Unix)
Server built: May 25 2015 04:58:27
:/#:/# /usr/IBMAHS/bin/apachectl -M
Loaded Modules:
core_module (static)
so_module (static)
http_module (static)
mpm_worker_module (static)
... (3 Replies)
Perl::Critic::Policy::ControlStructures::ProhibitPostfixUserrContributed PerlPerl::Critic::Policy::ControlStructures::ProhibitPostfixControls(3pm)NAME
Perl::Critic::Policy::ControlStructures::ProhibitPostfixControls - Write "if($condition){ do_something() }" instead of "do_something() if
$condition".
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
Conway discourages using postfix control structures ("if", "for", "unless", "until", "when", "while") because they hide control flow. The
"unless" and "until" controls are particularly evil because they lead to double-negatives that are hard to comprehend. The only tolerable
usage of a postfix "if"/"when" is when it follows a loop break such as "last", "next", "redo", or "continue".
do_something() if $condition; # not ok
if ($condition) { do_something() } # ok
do_something() while $condition; # not ok
while ($condition) { do_something() } # ok
do_something() unless $condition; # not ok
do_something() unless ! $condition; # really bad
if (! $condition) { do_something() } # ok
do_something() until $condition; # not ok
do_something() until ! $condition; # really bad
while (! $condition) { do_something() } # ok
do_something($_) for @list; # not ok
LOOP:
for my $n (0..100) {
next if $condition; # ok
last LOOP if $other_condition; # also ok
next when m< 0 z >xms; # fine too
}
CONFIGURATION
A set of constructs to be ignored by this policy can specified by giving a value for 'allow' of a string of space-delimited keywords: "if",
"for", "unless", "until", "when", and/or "while". An example of specifying allowed flow-control structures in a .perlcriticrc file:
[ControlStructures::ProhibitPostfixControls]
allow = for if until
By default, all postfix control keywords are prohibited.
The set of flow-control functions that are exempt from the restriction can also be configured with the 'flowcontrol' directive in your
.perlcriticrc file:
[ControlStructures::ProhibitPostfixControls]
flowcontrol = warn die carp croak cluck confess goto exit
This is useful if you're using additional modules that add things like "assert" or "throw".
NOTES
The "die", "croak", and "confess" functions are frequently used as flow-controls just like "next" or "last". So this Policy does permit
you to use a postfix "if" when the statement begins with one of those functions. It is also pretty common to use "warn", "carp", and
"cluck" with a postfix "if", so those are allowed too.
The "when" keyword was added to the language after Perl Best Practices was written. This policy treats "when" the same way it does "if",
i.e. it's allowed after flow-control constructs. Thanks to brian d foy for the inspiration
<http://www.effectiveperlprogramming.com/blog/543>.
BUGS
Look for the "do {} while" case and change the explanation to point to page 123 when it is found. RT #37905.
AUTHOR
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
COPYRIGHT
Copyright (c) 2005-2011 Imaginative Software Systems. All 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.14.22012-06-0Perl::Critic::Policy::ControlStructures::ProhibitPostfixControls(3pm)