creating arrays from text files
creating arrays from text files
am 26.12.2007 15:55:46 von Shell Solution
Hi,
I have a file that looks like this:
1
2
2
3
4
5
4
5
6
------------------------------------------------------------ ----------------------------
And I want to convert it to this:
moid1,1
moid1,2
moid1,2
moid2,3
moid2,4
moid2,5
moid3,4
moid3,5
moid3,6
Please advise.
Re: creating arrays from text files
am 26.12.2007 16:11:54 von Janis Papanagnou
Shell Solution wrote:
> Hi,
> I have a file that looks like this:
>
>
> 1
> 2
> 2
>
>
> 3
> 4
> 5
>
>
> 4
> 5
> 6
>
>
>
> ------------------------------------------------------------ ----------------------------
>
> And I want to convert it to this:
>
> moid1,1
> moid1,2
> moid1,2
>
> moid2,3
> moid2,4
> moid2,5
>
> moid3,4
> moid3,5
> moid3,6
>
>
> Please advise.
awk '/^
Janis
Re: creating arrays from text files
am 27.12.2007 04:01:26 von mik3l3374
On Dec 26, 10:55 pm, Shell Solution wrote:
> Hi,
> I have a file that looks like this:
>
>
> 1
> 2
> 2
>
>
> 3
> 4
> 5
>
>
> 4
> 5
> 6
>
>
> ------------------------------------------------------------ ----------------------------
>
> And I want to convert it to this:
>
> moid1,1
> moid1,2
> moid1,2
>
> moid2,3
> moid2,4
> moid2,5
>
> moid3,4
> moid3,5
> moid3,6
>
> Please advise.
if you have GNU awk
awk 'BEGIN{RS="\n||"}
{
for ( i=1 ; i<=NF;i++) print "moid"m,$i
m++
}' file
Re: creating arrays from text files
am 14.01.2008 09:24:14 von Shell Solution
Dear All,
I appreciate your responses, it has been helpful.
So here is the real deal.
Please find blow the content of 1 of the 24 files i receive daily,and
I meant to perform text extraction on.
------------------------------------------------------------ -------------------------
Actual Input
------------------------------------------------------------ -------------------------
1
INAT
MITMEDIA
20080114102500.2+0300
20080114103000.1+0300
300
TCAP_TPS
TCAP_COMPONENT_SENT
TCAP_COMPONENT_RECEIVED
MTP2_MSU_SENT
MTP2_MSU_RECEIVED
MTP2_LINK_LOAD
MTP2_LINK_LOAD_SENT
MTP2_LINK_LOAD_RECEIVED
SAAL_SDUS_SENT
SAAL_OCTETS_SENT
SAAL_OCTETS_RECEIVED
SAAL_LINK_LOAD_RECEIVED
SAAL_LINK_LOAD_SENT
SigMeas=InstanceId=2,HSN=0,SDL=2, Source = SS7
36.71
38.28
FALSE
SigMeas=InstanceId=1,HSN=0,SDL=2, Source = SS7
36.84
38.41
FALSE
SigMeas=InstanceId=4,HSN=0,SDL=1, Source = SS7
0.00
0.00
FALSE
SigMeas=InstanceId=3,HSN=0,SDL=1, Source = SS7
0.00
0.00
FALSE
SigMeas=InstanceId=2,HSN=0,SDL=1, Source = SS7
36.93
38.16
FALSE
SigMeas=InstanceId=1,HSN=0,SDL=1, Source = SS7
36.88
38.01
FALSE
SigMeas=DEFAULT, Source = SS7
118.19
32982
22633
20367
26581
175.49
FALSE
SigMeas=DEFAULT, Source = _SYSTEM
118.19
32982
22633
20367
26581
175.49
FALSE
20080114103000.1+0300
------------------------------------------------------------ -------------------------
Desired Output
------------------------------------------------------------ -------------------------
InstanceId=2
36.71
38.28
InstanceId=1
36.84
38.41
InstanceId=4
0
0
InstanceId=3
0
0
InstanceId=2
36.93
38.16
InstanceId=1
36.88
38.01
DEFAULT
118.19
32982
22633
20367
26581
175.49
DEFAULT
118.19
32982
22633
20367
26581
175.49
On Dec 26 2007, 5:55 pm, Shell Solution
wrote:
> Hi,
> I have a file that looks like this:
>
>
> 1
> 2
> 2
>
>
> 3
> 4
> 5
>
>
> 4
> 5
> 6
>
>
> ------------------------------------------------------------ ----------------------------
>
> And I want to convert it to this:
>
> moid1,1
> moid1,2
> moid1,2
>
> moid2,3
> moid2,4
> moid2,5
>
> moid3,4
> moid3,5
> moid3,6
>
> Please advise.
Re: creating arrays from text files
am 14.01.2008 21:55:02 von Cyrus Kriticos
Shell Solution wrote:
>
> I appreciate your responses, it has been helpful.
> So here is the real deal.
>
> Please find blow the content of 1 of the 24 files i receive daily,and
> I meant to perform text extraction on.
sed -ne 's#.*s=\([a-zA-Z0-9=]*\),.*#\1#p' -e 's#\(.*\)#\1#p' filename
--
Best regards | Be nice to America or they'll bring democracy to
Cyrus | your country.