awk 'substr($0,5,6)>="922000" && substr($0,5,6)<="9229999"' file
This will not work, since you are testing 6 characters substr($0,5,6) against a number of 7 digit number 9229999
Not sure if you like 6 or 7 digit numbers 922000 vs 9229999
I would like to append a string at the end of each row of a .dat file.
please give me some advice? Thanks.
e.g.
#content in abc.dat
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
...
#after running the script/command,... (7 Replies)
Hello All,
Plz help me with:
I have a csv file with data separated by ',' and optionally enclosed by "". I want to check each of these values to see if they exceed the specified string length, and if they do I want to cut just that value to the max length allowed and keep the csv format as it... (9 Replies)
Hello,
i have a file "Movie.ini" looking e.g. like follows
* MOVIE A
bla bla
MOVIE B
blubb blubb
MOVIE C
I'd like to read the file "Movie.ini" with cat and grep and check whether it includes the string MOVIE only with a '*' at the beginnig.
By doing
"cat Movie.ini| grep MOVIE... (14 Replies)
I'm getting the input row in this format it contains 2 alphabets followed by numbers between 1 and 7 and again 2 alphabets followed by numbers between 1 and 7.
Now I need to parse this input into several output rows in this format 2 alphabets followed by each number occurrence
suppose... (5 Replies)
1)I need to write a script which ftps 3 files to a unix box,
2)once the files are ftped i need to check the number of rows in each file and compare it with the data (no of rows) coming in a manifest file, if the number of rows in each file matches the data coming in manifest file, then i need to... (3 Replies)
Hi am using unix aix
I have tried using awk but am getting only output = x ,its not incrementing next output
set -A var1 vv qa za
ct=0
i=3
while
do
var1=`echo ${var1}`
count=`awk ' NR==$i++ {print;exit}' ${.txt} | cut -c5 `
echo $count
let ct=ct+1
done (6 Replies)
I want to append file with a string but before doing that i want to check if this string already exist in that file.I tried with grep on Solaris 10 but unsuccessful.Man pages from grep seems to suggest if the string is found command status will be 0 and if not 1.But i am not finding it.May be i... (2 Replies)
Hi,
I have file with values as below
1~ab~456~ac:bd:de:ef~yyyy-mm-dd
2~cd~458~af:fg:ty:er:ty:uj:io:~yyyy-mm-dd
I want the o/p as for frist row
1~ab~456~ac~yyyy-mm-dd
1~ab~456~bd~yyyy-mm-dd
1~ab~456~de~yyyy-mm-dd
1~ab~456~ef~yyyy-mm-dd
and for the second row
2~cd~458~af~yyyy-mm-dd... (4 Replies)
Hi,
I have a requirement that has 50-60 million records that we need to split a delimited string (Delimeter is newline) into rows.
Source Date:
SerialID UnidID GENRE
100 A11 AAAchar(10)BBB
200 B11 CCCchar(10)DDD(10)ZZZZ
Field 'GENRE' is a string with new line as delimeter and not sure... (5 Replies)
Perl::Critic::Policy::BuiltinFunctions::ProhibitLvalueSuUser(Contributed Perl DocumPerl::Critic::Policy::BuiltinFunctions::ProhibitLvalueSubstr(3)NAME
Perl::Critic::Policy::BuiltinFunctions::ProhibitLvalueSubstr - Use 4-argument "substr" instead of writing "substr($foo, 2, 6) = $bar".
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
Conway discourages the use of "substr()" as an lvalue, instead recommending that the 4-argument version of "substr()" be used instead.
substr($something, 1, 2) = $newvalue; # not ok
substr($something, 1, 2, $newvalue); # ok
The four-argument form of "substr()" was introduced in Perl 5.005. This policy does not report violations on code which explicitly
specifies an earlier version of Perl (e.g. "use 5.004;").
CONFIGURATION
This Policy is not configurable except for the standard options.
SEE ALSO
"substr" in perlfunc (or "perldoc -f substr").
"4th argument to substr" in perl5005delta
AUTHOR
Graham TerMarsch <graham@howlingfrog.com>
COPYRIGHT
Copyright (c) 2005-2011 Graham TerMarsch. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.16.3 2014-06-09 Perl::Critic::Policy::BuiltinFunctions::ProhibitLvalueSubstr(3)