Search Results

Search: Posts Made By: umarsatti
2,339
Posted By Aia
A bit of Perl perl -plaF'\|' -e '$F[-1] =~...
A bit of Perl

perl -plaF'\|' -e '$F[-1] =~ s/(\d+)/$F[3]$1/g; s/[\d,]+$/$F[-1]/' file.txt
USS|AWCC|AFGAW|93|9370
USSAA|Roshan TDCA|AFGTD|93|9372,9379
ALB|Vodafone|ALBVF|355|35569...
2,339
Posted By anbu23
$ awk -F"|" -v OFS="|" ' $NF { $NF=","$NF;...
$ awk -F"|" -v OFS="|" ' $NF { $NF=","$NF; gsub(",",","$(NF-1),$NF); sub(",","",$NF) } 1 ' file
USS|AWCC|AFGAW|93|9370
USSAA|Roshan TDCA|AFGTD|93|9372,9379
ALB|Vodafone|ALBVF|355|35569...
2,339
Posted By RavinderSingh13
Hello umarsatti, Following is the...
Hello umarsatti,

Following is the explanation for same.

awk -vs1="," -F"|" '{ ######## taking a variable named s1 whose value is comma(,) and setting field separator to |
A=$(NF-1); ...
2,339
Posted By Don Cragun
Since for index in array_name produces the index...
Since for index in array_name produces the index list in an unspecified order, the order of the output subfields will not necessarily be in the same order as the subfields in the input when using...
2,339
Posted By RavinderSingh13
Hello umarsatti, Could you please try...
Hello umarsatti,

Could you please try following and let me know if this helps.

awk -vs1="," -F"|" '{A=$(NF-1);split($NF, B,",");for(i in B){C=C?C s1 A B[i]:A B[i];$NF=C;}C=""} 1' OFS="|" ...
1,851
Posted By RudiC
Given that RavinderSingh13 interpreted your new...
Given that RavinderSingh13 interpreted your new data file correctly, this might work as well:sed 's/ *:.*:SSN: /,/; s:/KEYVALUE>::' file

---------- Post updated at 19:47 ---------- Previous update...
1,851
Posted By Scrutinizer
Note: --re-interval is a GNU command line option...
Note: --re-interval is a GNU command line option so that interval expressions ({m.n}) can be used with GNU awk 3 or lower.
It is not needed with GNU awk 4 and up. It will not work will other awk's....
1,851
Posted By RavinderSingh13
Hello umarsatti, Seems your attachment...
Hello umarsatti,

Seems your attachment provided Input_file is having different input values compare to sample shown in your very first post, following may help you in same.

awk --re-interval...
1,851
Posted By RavinderSingh13
Hello umarsatti, Following may help you in...
Hello umarsatti,

Following may help you in same.

awk --re-interval '{match($0,/[0-9]{12}+/);B=substr($0,RSTART,RLENGTH);match($0,/RemoteSPC: [0-9]+/);print B OFS...
1,851
Posted By sea
Please use code tags...
Please use code tags https://www.unix.com/images/editor/code.png, not icode https://www.unix.com/images/icode.png tags for multiline code samples.

What have you tried so far?

---------- Post...
1,681
Posted By elixir_sinari
Use nawk on Solaris.
Use nawk on Solaris.
9,609
Posted By kashif_islam
Hello Umar I really admire your enthusiasm for...
Hello Umar
I really admire your enthusiasm for shell scripting and thanks for your contribution towards this forum. you can solve this by putting following in crontab:

bash -l script
3,512
Posted By itkamaraj
use awk, if you dont have nawk $ nawk...
use awk, if you dont have nawk


$ nawk '/Node/,/<\/Node/{if($0~/Apple/)a=1;}{if($0~/Value3/ && a){sub("Value3","Value4");a=0}}1' test.txt
<Node>Apple
<B>Value1</B>
<B>Value2</B>...
Showing results 1 to 13 of 13

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