Search Results

Search: Posts Made By: hernand
1,369
Posted By itkamaraj
what is the relation b/w the input and output ?
what is the relation b/w the input and output ?
29
5,736
Posted By bartus11
I implemented line swapping as well, check if it...
I implemented line swapping as well, check if it is working properly: #!/usr/bin/perl
open I, "$ARGV[0]";
@x=<I>;
$i=0;
for (@x){
s/ +$//;
$t=$_;
@s=split / +/;
if ($#s==12){
...
29
5,736
Posted By bartus11
No need to apologize ;) Try: #!/usr/bin/perl ...
No need to apologize ;) Try: #!/usr/bin/perl
open I, "$ARGV[0]";
@x=<I>;
$i=0;
for (@x){
s/ +$//;
$t=$_;
@s=split / +/;
if ($#s==11){
$i=1;
s/([^ ]+ +EUR)1([SB]\d+ +)[^ ]+(...
29
5,736
Posted By bartus11
Try this then: #!/usr/bin/perl open I,...
Try this then: #!/usr/bin/perl
open I, "$ARGV[0]";
@x=<I>;
$i=0;
for (@x){
s/ +$//;
$t=$_;
@s=split / +/;
if ($#s==12){
$i=1;
s/([^ ]+ +EUR)1([SB]\d+ +)[^ ]+( +)1/$1$2 ...
29
5,736
Posted By bartus11
Try this one: #!/usr/bin/perl open I,...
Try this one: #!/usr/bin/perl
open I, "$ARGV[0]";
@x=<I>;
$i=0;
for (@x){
s/ +$//;
$t=$_;
@s=split / +/;
if ($#s==12){
$i=1;
s/([^ ]+ +EUR)1([SB]\d+ +)[^ ]+( +)1/$1$2 ...
29
5,736
Posted By bartus11
Are you sure "30416938966" is Unix time? Current...
Are you sure "30416938966" is Unix time? Current Unix timestamp is "1307530654", so 23 times less than your number. Also using simple Perl converter doesn't seem to recognize your number as Unix...
29
5,736
Posted By bartus11
Try: #!/usr/bin/perl open I, "$ARGV[0]"; ...
Try: #!/usr/bin/perl
open I, "$ARGV[0]";
@x=<I>;
chomp($d=`date +%Y%m%d`);
$i=0;
for (@x){
s/ +$//;
$t=$_;
@s=split / +/;
if ($#s==10){
$i=1;
s/([^ ]+ +EUR)1([SB]\d+ +)[^...
2,532
Posted By getmmg
Hi, Can you post the the code which gives...
Hi,

Can you post the the code which gives the output as shown above.
2,532
Posted By Skrynesaver
30416938966 is not an epoch time, at least not...
30416938966 is not an epoch time, at least not this millennium it's not.

to convert from epoch to your format try

perl -e'
@time=localtime($epoch) ;
printf...
29
5,736
Posted By bartus11
Can the output look like this? H: EURS890 ...
Can the output look like this? H: EURS890 00440000000069.110100000963 DE0008032004 2CBKd 20110607-07:50:59BNABFRPP DE BNABFRPP PARBFRPP #
H: EURB890 ...
29
5,736
Posted By bartus11
Try: perl -0ne '$x=$_;s/^([^ ]+ +AAA)1([^ ]+)(...
Try: perl -0ne '$x=$_;s/^([^ ]+ +AAA)1([^ ]+)( +)[^ ]+( +)1([^ ]+ +[^ ]+$)/$1$2$3 ${4}0$5/mg;print $_,$x' file
29
5,736
Posted By bartus11
Try: perl -0ne '$x=$_;s/^([^ ]+ +AAA)1([^ ]+)(...
Try: perl -0ne '$x=$_;s/^([^ ]+ +AAA)1([^ ]+)( +)[^ ]+( +)1/$1$2$3 ${4}0/mg;print $_,$x' file
29
5,736
Posted By Shahul
$ nawk '{if(NF>10) {print $0"-"NR"\n"$0} else...
$ nawk '{if(NF>10) {print $0"-"NR"\n"$0} else {print $0}}' input.txt|nawk 'NF>11 {$2="EUR"$3;$3="";$NF=""}{print |"sort -n -k3 -r"}'


Thanks
Sha
29
5,736
Posted By bartus11
Try this script: #!/usr/bin/perl open I,...
Try this script: #!/usr/bin/perl
open I, "$ARGV[0]";
@x=<I>;
$i=0;
for (@x){
s/ +$//;
$t=$_;
@s=split / +/;
if ($#s==10){
$i=1;
s/([^ ]+ +EUR[SB])1(\d+ +)[^ ]+( +)1/$1$2 ...
29
5,736
Posted By bartus11
Ok, so if three consecutive lines have 11...
Ok, so if three consecutive lines have 11 columns, then three new lines should be inserted above them? Example.. input:H: EURS1892 S892 10440000000000.003000000450 FR0000130007 2ALUp ...
29
5,736
Posted By bartus11
[root@linux ~]# ./a.pl c H: EURS891 ...
[root@linux ~]# ./a.pl c
H: EURS891 10440000000000.003000000450 FR0000130007 2ALUp 20110607-08:34:25TRADETES PA TRADETES TESTCLRXX #
H: EURB891 ...
29
5,736
Posted By bartus11
EUR1B892 and EURB1892 are quite different... Try...
EUR1B892 and EURB1892 are quite different... Try this:#!/usr/bin/perl
open I, "$ARGV[0]";
@x=<I>;
$i=0;
for (@x){
s/ +$//;
$t=$_;
@s=split / +/;
if ($#s==10){
$i=1;
s/([^ ]+...
2,463
Posted By vgersh99
to swap columns 4 - adjust as needed. nawk...
to swap columns 4 - adjust as needed.

nawk -v c=4 'BEGIN{ARGV[ARGC++]=ARGV[1]} FNR==NR{a[FNR]=$c;next}{$c=(FNR%2)?a[FNR+1]:a[FNR-1]}1' myFile
2,463
Posted By vgersh99
nawk 'BEGIN{ARGV[ARGC++]=ARGV[1]}...
nawk 'BEGIN{ARGV[ARGC++]=ARGV[1]} FNR==NR{a[FNR]=$(NF-1);next}{$(NF-1)=(FNR%2)?a[FNR+1]:a[FNR-1]}1' myFile
2,463
Posted By pravin27
awk -F'x' '{a=$2;printf FS $2 FS;getline;printf...
awk -F'x' '{a=$2;printf FS $2 FS;getline;printf $3"\n" FS $3 FS a"\n";}' mydata.txt
2,463
Posted By bartus11
Try: awk...
Try: awk 'NR%2{x=$2}!NR%2{$2=x;print;$2=$4;$4=x;print}' mydata.txt
2,463
Posted By bartus11
perl -anse 'BEGIN{$c--};if...
perl -anse 'BEGIN{$c--};if ($.%2){$x=$_;$y=$F[$c]};if ($.%2==0) {$x=~s/(([^\s]+\s+){$c})\w+/\1$F[$c]/;print $x;s/(([^\s]+\s+){$c})\w+/\1$y/;print}' -- -c=5 mydata.txt
c=5 means 5th column.
2,463
Posted By bartus11
You can also try this: perl -ane 'if...
You can also try this: perl -ane 'if ($.%2){$x=$_;$y=$F[2]};if ($.%2==0) {$x=~s/(([^\s]+\s+){4})\w+/\1$F[4]/;print $x;s/(([^\s]+\s+){4})\w+/\1$y/;print}' mydata.txt
2,463
Posted By vgersh99
assuming all the fields are of the constant...
assuming all the fields are of the constant width....

nawk -v c=5 '
BEGIN {
ARGV[ARGC++]=ARGV[1]
}
FNR==NR && NR==1 {
copy0=$0
for(i=1;i<=NF;i++){
match(copy0, FS FS "*")
...
2,463
Posted By vgersh99
I don't follow your sample. Given your latest...
I don't follow your sample.
Given your latest sample and

nawk -v c=5 'BEGIN{ARGV[ARGC++]=ARGV[1]} FNR==NR{a[FNR]=$c;next}{$c=(FNR%2)?a[FNR+1]:a[FNR-1]}1' yourLatestSample

produces:

x 20 x y...
Showing results 1 to 25 of 34

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