Search Results

Search: Posts Made By: jimmy_y
4,183
Posted By jimmy_y
Hi Aia, Thanks, after run your cmd, the...
Hi Aia,

Thanks, after run your cmd, the output will be
6000
7599

but the output should be
6000
7000
7100
7200
7300
7400
7599

:confused:
4,183
Posted By jimmy_y
Extract Uniq prefix from a start and end prefix
Dear All,

assume i have a file with content:
<Start>6000</Start>
<Stop>7599</Stop>

the output is:
6000
7000
7100
7200
7300
7400
7599

how should we use any awk, sed, perl can do this...
1,002
Posted By jimmy_y
Thanks, got the point single quote
Thanks, got the point single quote
960
Posted By jimmy_y
Thanks, got both your points.
Thanks, got both your points.
1,002
Posted By jimmy_y
I cannot scape $ in the $ARGV as this is from...
I cannot scape $ in the $ARGV as this is from customer input...

how to detect customer input $ infront of the string. :confused:
960
Posted By jimmy_y
perl regular expression not inbetween issue
Dear All,


perl -e 'if($ARGV[0] =~ /\A^[0-9]{10}\z/){print "Valid string\n"}else{print "Invalid string\n"}' '1234567899'
Valid string

perl -e 'if($ARGV[0] =~ /\A^[0-9]{8}\z/){print "Valid...
1,002
Posted By jimmy_y
perl regular expression deal with $
Dear All,


#!/usr/bin/perl
use strict;
use warnings;

my $tmp = $ARGV[0];

if ($tmp =~ s/[\ \$]//g > 0) {
print "yes\n"
} else {
print "no\n";
}


Output is:
...
1,849
Posted By jimmy_y
Thanks all, btw, i cannot combine both rules into...
Thanks all, btw, i cannot combine both rules into >2, each one has it is own rule, just having the same $tmp.
1,849
Posted By jimmy_y
Combine two regular expression perl
Dear All,


my $tmp="*3f4#_#33#"
if ($tmp =~ tr/*// > 1 || $tmp =~ tr/#// > 2) {
print "yes";
}


any possible to combine both regular expression into one?

Thanks
1,330
Posted By jimmy_y
Thanks elixir, learnt a lot. :b:
Thanks elixir, learnt a lot. :b:
1,330
Posted By jimmy_y
Thanks elixir, it works perfect. regarding the...
Thanks elixir, it works perfect.
regarding the \A, and \z, would u please guide me those two meaning.
1,330
Posted By jimmy_y
Determine the string is valid
Dear All,

I have a string "1234567899*0#123456789#", it can be divided into:
- 1st: 1234567899 Validation: 10 digits, only 0-9
- 2nd: *0# Fixed Value
- 3rd: 123456789 Validation: 9...
2,557
Posted By jimmy_y
Thanks Dan, but the output is <a><a""...
Thanks Dan,

but the output is
<a><a"" dd>weopriuew</f><">!(^)!</aa></ff>
<a><a"" dd>weopriuew</f><">!(^*)!</aa></ff>

the correct output is
<a><a"" dd>aaopriuew</f><">!(^)!</aa></ff>...
2,557
Posted By jimmy_y
Thanks jayan_jay, but your way is same as i use...
Thanks jayan_jay, but your way is same as i use perl -i -e.
image each line is not just aaaaa to aa, but you have asdff to as, 89099 to 89... it means only keep the 1st two characters.
2,557
Posted By jimmy_y
cut certain characters for each line in a file
Hi Everyone,
i have a file 1.txt
<a><a"" dd>aaaaauweopriuew</f><">!(^)!</aa></ff>
<a><a"" dd>bbbbbuweopriuew</f><">!(^*)!</aa></ff>
i know i can use
perl -p -i -e "s/>aaaaa/aa/g" 1.txt
perl -p...
4,886
Posted By jimmy_y
awk output field delimiter
Dear All,

1.txt (tab in between each value in a line)
a b c
a b c
a c d

you can see below, why with ~ i can output with tab, but = cannot?
[root@]# awk...
2,987
Posted By jimmy_y
awk print lines in a file
Dear All,

a.txt
A 1 Z
A 1 ZZ
B 2 Y
B 2 AA

how can i use awk one line to achieve the result:
A Z|ZZ
B Y|AA


Thanks
1,795
Posted By jimmy_y
perl or sed replace lines only if for all files
Hi Everyone,


[root@]# cat 3
a
b
[root@]# cat 4
a
b

[root@]# perl -p -i -e "s/.*/c/ if $.==2" *

[root@]# cat 3
a
c
[root@]# cat 4
a
b
19,768
Posted By jimmy_y
awk with two conditions
Hi Everyone,


[root@]# cat 1
1;2;3;4;5;6
1;2;3;4;5;

[root@]# awk -F ";" '$5 == "5"' 1
1;2;3;4;5;6
1;2;3;4;5;


but the output is should be just "1;2;3;4;5;6" means 1st condition: $5 is...
2,726
Posted By jimmy_y
perl sum 2nd field in an array
Hi Everyone,


($total+=$_) for @record;


assume @record=(1,2,3), so the result is 6.
if @record=("1 3","2 3","3 3"), would like to sum up the 2nd field of this array, the result is 9.
i...
4,931
Posted By jimmy_y
hi zaxxon, thanks for hint using "fgrep -f...
hi zaxxon,
thanks for hint using "fgrep -f 1.txt 2.txt" it saves me so much time. just now the original script by using grep took me 10mins, now just 2,3 seconds.
:eek: amazing
4,931
Posted By jimmy_y
"grep -F(upper case)"; cannot get the...
"grep -F(upper case)"; cannot get the result.
4,931
Posted By jimmy_y
assume 1.txt has 33k lines, 2.txt has 20k lines...
assume 1.txt has 33k lines, 2.txt has 20k lines (each line has many many fields)
if "grep -f 1.txt 2.txt", it took me 5 mins to get the result, but if "fgrep -f 1.txt 2.txt", it took just a second...
4,931
Posted By jimmy_y
:eek:: the script by using grep need more than...
:eek::
the script by using grep need more than 5 mins, but fgrep takes just 1 second :eek:: still cannot believe fgrep is so fast than grep.
4,931
Posted By jimmy_y
ha~~~ :eek: so simple!!! Thanks ----------...
ha~~~ :eek: so simple!!!
Thanks

---------- Post updated at 03:24 AM ---------- Previous update was at 03:15 AM ----------

err...
the line of code is simple, but actually when i run my two big...
Showing results 1 to 25 of 209

 
All times are GMT -4. The time now is 08:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy