Ok....this is probably a lot more work that is needed....but does work! I just piped the data into Perl and processed each character at a time adding a space if the position existed in the hash.
Can anyone help me find and replace blank rows in a file with a numeric value (ie blankrow=someTxtOrNumValue), the file is over 500,000 rows long so it would need to be the quickest way as I'll need to do this for multiple files...I would be greatfull for any suggestions....thanks
sample file:... (2 Replies)
hi,
could anyone tell me the command to append spaces at the end of the line.
for example, i need 1000 spaces after the word "helloworld"
echo "helloworld " i need to achieve this in someother way hardcoding 1000 spaces is not practical.
as i am totally new... (3 Replies)
I need to add spaces in between characters in a string variable.
Is there a shortcut? I know you can remove the spaces with sed, but does sed have a way to add them?
Example:
I have: DATA01
I want it to be: D A T A 0 1
What I have done so far is to create a function... (4 Replies)
what my code is doing, it is executing a sql file and the resullset of the query is getting stored in the text file in a fixed format. for that fixed format i have used the following code::
Code:
awk -F":"... (2 Replies)
I have a file with varying record length in it. I need to reformat this file so that each line will have a length of 100 characters (99 characters + the line feed).
AU * A01 EXPENSE 6990370000 CWF SUBC TRAVEL & MISC
MY * A02 RESALE 6990788000 Y... (3 Replies)
I have large number of data files, close to 300 files, lets say all files are same kind and have extension .dat , each file have mulitple lines in it.
There is a unique line in each file containing string 'SERVER'. Right after this line there is another line which contain a string 'DIGIT=0',... (4 Replies)
Hi,
I am creating a script to do a find and replace single/multiple lines in a file with any number of lines.
I have written a logic in a script that reads a reference file say "findrep" and populates two variables $FIND and $REPLACE
print $FIND gives
Hi How r $u
Rahul()
Note:... (0 Replies)
Hi, I wish to replace a new line with br (html) but it doesn't seem to work
message=$(echo ${FORM_message} | tr '\r' '<br \/>' )
what it gives me seems to be ... b...?
I am also having problem escaping hash sign in cut command:
list=$(echo "$line" | cut -d'\#;\#' -f1) ;
my intention is... (2 Replies)
Greetings,
I recently built a replicated DRBD, Heartbeat, & iSCSI Target Initiator storage server on Ubuntu 10.04 to offer shared storage to server Vmware ESX and Microsoft Clusters. Everything works flawlessly, however I wanted to make a script to create, remove, grow volumes to offer ESX... (6 Replies)
Hello,
I need a program that read a file line by line and prints out lines 1, 2 & 3 after an empty line... An example of entries in the file would be:
SRVXPAPI001 ERRO JUN24 07:28:34 1775
REASON= 0000, PROCID= #E506 #1065: TPCIPPR, INDEX= 003F
... (8 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)