05-12-2014
regular expression match and insert line before ending the module
Thanks Protocomm
But this is a small section of the file
so I need to match with mod1 and mod2 regular expression and insert the line where those modules are ending before ));
Thanks
Kshitij
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi there,
may someone easily help me on this :
I want to insert a text in a specific line number like :
linenumb2start=`cat memory_map.dld | nl -ba | egrep -i "label" | cut -f1`
line2insert=`expr $linenumb2start + 2`
and now I need to replace something like {} with {comment} at... (8 Replies)
Discussion started by: homefp
8 Replies
2. Shell Programming and Scripting
Hi I'm new to sed, and need to add characters into a specific location of a file, the fileds are tab seperated.
text <tab> <tab> text <tab> text EOL
I need to add more characters to the line to look like this:
text <tab> <tab> newtext <tab> text <tab> text EOL
Any ideas? (2 Replies)
Discussion started by: tangentviper
2 Replies
3. Shell Programming and Scripting
I know that
sed -n '12p' file
will print line 12 but how might I insert text to a specified line?
thanks (2 Replies)
Discussion started by: action_owl
2 Replies
4. AIX
Hi,
I have to insert a line having variables using sed. But the variables are not getting substituted within sed.
Ex:
n=2
sed $n' i\
hi' file
This works. But the below code does not work.
n=2
line=hello
sed $n' i\
$line' file
The above code inserts '$line' in the 2nd line of the... (9 Replies)
Discussion started by: sugan
9 Replies
5. UNIX for Advanced & Expert Users
Hi Guys,
can any one know how to replace the string by newline using sed ?
i dont need any other solution. I am very curious to know this in sed.
Input:
one,two,three
Output
one
two
three
we can acheive this by awk but in sed ?,
awk '{gsub(/\,/,"\n");print;}' File (6 Replies)
Discussion started by: rangarasan
6 Replies
6. Shell Programming and Scripting
Just posted on another fellow's question using ed, but I wanted to know about doing it with sed on Unix. For example - I have a file of an unknown length, but I want to add a line after the shell declaration (Line 2). If possible, I'd like the example to be able to just substitute in a number and... (2 Replies)
Discussion started by: Vryali
2 Replies
7. Shell Programming and Scripting
Hello.
I have a config file (/etc/my_config_file) which may content :
#
# port for HTTP (descriptions, SOAP, media transfer) traffic
port=8200
# network interfaces to serve, comma delimited
network_interface=eth0
# set this to the directory you want scanned.
# * if have multiple... (6 Replies)
Discussion started by: jcdole
6 Replies
8. Shell Programming and Scripting
Hi,
I want to insert a value (x) in the 3rd position of each line in a file like below
a|b|c|d|1
a|b|c|d
a|b|c|d|e|1
a|b|cso that output file looks like
a|b|x|c|d|1
a|b|x|c|d
a|b|x|c|d|e|1
a|b|x|cI can do that using perl as below
#!/usr/bin/perl -w
use strict;
#inserting x at... (5 Replies)
Discussion started by: sam05121988
5 Replies
9. Shell Programming and Scripting
Hello,
I have a file with multiple paragraphs/sections each starting with word "Handle" and if I grep for a pattern, I should get contents of entire section/para (not just line). Please advise, thanks!
#script.sh file.txt "System Information"
Handle 0x0001
DMI type 1, 27 bytes.
... (9 Replies)
Discussion started by: reddyr
9 Replies
10. Solaris
Hi
I am trying to run a sed command within a script..unfortunately it wasn't written on Solaris so doesn't work. Can anyone help with the correct coding please?
It is:
sed -i '1i ROWID;ORDER_ID;JOB_NAME;ORDER_TABLE' ${OUTFILE} (4 Replies)
Discussion started by: Grueben
4 Replies
LEARN ABOUT DEBIAN
perl::critic::policy::modules::prohibitevilmodules
Perl::Critic::Policy::Modules::ProhibitEvilModules(3pm) User Contributed Perl DocumentationPerl::Critic::Policy::Modules::ProhibitEvilModules(3pm)
NAME
Perl::Critic::Policy::Modules::ProhibitEvilModules - Ban modules that aren't blessed by your shop.
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
Use this policy if you wish to prohibit the use of specific modules. These may be modules that you feel are deprecated, buggy,
unsupported, insecure, or just don't like.
CONFIGURATION
The set of prohibited modules is configurable via the "modules" and "modules_file" options.
The value of "modules" should be a string of space-delimited, fully qualified module names and/or regular expressions. An example of
prohibiting two specific modules in a .perlcriticrc file:
[Modules::ProhibitEvilModules]
modules = Getopt::Std Autoload
Regular expressions are identified by values beginning and ending with slashes. Any module with a name that matches "m/pattern/" will be
forbidden. For example:
[Modules::ProhibitEvilModules]
modules = /Acme::/
would cause all modules that match "m/Acme::/" to be forbidden.
In addition, you can override the default message ("Prohibited module "module" used") with your own, in order to give suggestions for
alternative action. To do so, put your message in curly braces after the module name or regular expression. Like this:
[Modules::ProhibitEvilModules]
modules = Fatal {Found use of Fatal. Use autodie instead} /Acme::/ {We don't use joke modules}
Similarly, the "modules_file" option gives the name of a file containing specifications for prohibited modules. Only one module
specification is allowed per line and comments start with an octothorp and run to end of line; no curly braces are necessary for delimiting
messages:
Evil # Prohibit the "Evil" module and use the default message.
# Prohibit the "Fatal" module and give a replacement message.
Fatal Found use of Fatal. Use autodie instead.
# Use a regular expression.
/Acme::/ We don't use joke modules.
By default, the modules that have been deprecated by the Perl 5 Porters are reported; at the time of writing these are Class::ISA,
Pod::Plainer, Shell, and Switch. Specifying a value for the "modules" option will override this.
NOTES
Note that this policy doesn't apply to pragmas.
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.2 2012-06-07 Perl::Critic::Policy::Modules::ProhibitEvilModules(3pm)