09-11-2008
Hi,
I have three files and basis on that I'll generate one more file with new three columns - Folder no. , Site , Device Name
This is one file ---Input file
1DATE HHIDLDS BothOff 91 NG A=D 90faulRoundOnOff OffOn OthersMATCHED NOMATCH MATCH%
0721 0201136 1 544 . . . 1 . . . 895 1 99.89
0721 0201347 1 1296 . . . . . . . 144 . 100.0
0721 0201347 2 818 . . . . . . . 622 . 100.0
0721 0201364 1 1123 . . . . . . . 317 . 100.0
0721 0201364 2 1327 . . . . . . . 113 . 100.0
Second DCDB.xml
DCDB.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<DCDBTable>
<DCDBEntry DCDB="0862976 " folder="768678" timeZone="2"/>
<DCDBEntry DCDB="0911297 " folder="975426" timeZone="1"/>
<DCDBEntry DCDB="0201347 " folder="1389781" timeZone="2"/>
<DCDBEntry DCDB="0800659 " folder="2035595" timeZone="4"/>
<DCDBEntry DCDB="0123033 " folder="2143699" timeZone="2"/>
<DCDBEntry DCDB="0911515 " folder="2315643" timeZone="1"/>
<DCDBEntry DCDB="0123913 " folder="2367867" timeZone="2"/>
<DCDBEntry DCDB="0713934 " folder="2407712" timeZone="5"/>
Thrid File LDS.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<LDSMappingTable>
<LDSEntry LDSKey="3351216:1:TV" LDSValue="7"/>
<LDSEntry LDSKey="1389781:1:VCR1" LDSValue="2"/>
<LDSEntry LDSKey="3351216:2:TV" LDSValue="2"/>
<LDSEntry LDSKey="3351216:3:TV" LDSValue="6"/>
<LDSEntry LDSKey="3351511:1:TV" LDSValue="10"/>
<LDSEntry LDSKey="3351511:1:VCR1" LDSValue="11"/>
<LDSEntry LDSKey="3351511:2:TV" LDSValue="4"/>
<LDSEntry LDSKey="3351511:2:VCR1" LDSValue="5"/>
Then I'll make new file as input_new.txt as
1DATE HHIDLDS BothOff 91 NG A=D 90faulRoundOnOff OffOn OthersMATCHED NOMATCH MATCH% Folder SU Dev
0817 0201364 1 866 . . . . . . . 574 . 100.0 100.0 5529737 1 TV
0817 0201364 2 1440 . . . . . . . . . . . 5529737 1 VCR1
0817 0201364 6 1323 . . . . . . . 117 . 100.0 100.0 5529737 4 TV
0817 0201364 7 1440 . . . . . . . . . . . 5529737 3 TV
Please help me to avoid these repeating columns value against second columns values.
Thanks a lot
10 More Discussions You Might Find Interesting
1. Solaris
The unix servers at my site are constantly receiving "community check" messages from a server located on our WAN, in another city. Here is the example:
Jan 23 15:41:08 eagles/usr/lib/snmp/snmpdx: community_check();bad community from rams.nw.sw.ournetwork.com
How can I filter out these... (2 Replies)
Discussion started by: antalexi
2 Replies
2. UNIX for Dummies Questions & Answers
Can someone help me with the following 2 objectives?
1) The following command is just an example. It gets a list of all print jobs. From there I am trying to extract the printer name. It works with the following command:
lpstat -W "completed" -o | awk -F- '{ print $1}'
Problem is, I want... (6 Replies)
Discussion started by: TheCrunge
6 Replies
3. Shell Programming and Scripting
Hi
I am trying to locate all strings seperated by the string -CR-, the string will have an unknown number of these -CR- strings, I've used the regex:
^(?:(.*?)-CR-)+$
As shown in the test code:
my ($myString)="This is the first line-CR-second line-CR-third line-CR-fourth... (3 Replies)
Discussion started by: joncoop
3 Replies
4. Shell Programming and Scripting
Hi all,
I have an awk command that needs to be ran multiple times in a script on one file containing lots of fields of data.
The file look like this (the numbers are made up):
1234 2222 2223 2222
123 2223 3333 2323
3333 3321 3344 4444
The... (2 Replies)
Discussion started by: nistleloy
2 Replies
5. Shell Programming and Scripting
Hello,
I have file to work with. It has 5 columns. The first three, altogether, constitutes the position. The 4th column contains some values for downstream analysis and the fifth column contains some values that I want to add to 4th column (only if they happen to be in the same position).
My... (5 Replies)
Discussion started by: menenuh
5 Replies
6. Shell Programming and Scripting
Hi all,
I'm learning sed (and regular expressions) - My first little program is to replace 3 numbers in a row with 'XXX'
This is what I am trying:
echo '511' | sed 's/{3}/XXX/'
Here is the output:
defunct-macbook-pro:~ defunct$ echo '511' | sed 's/{3}/XXX/'
511For some reason, it doesnt... (2 Replies)
Discussion started by: Defunct
2 Replies
7. UNIX for Dummies Questions & Answers
Hi all! I am new to Unix programming so bare with me please :).
I have saved the output of my results in a file called testfile which contains 3 columns a 15 rows.
e.g.
175 754 abvd
948 454 fewf
43 754 fewc
6 734 feww
xxx xxx xxxx I want to sort the contents of this file... (10 Replies)
Discussion started by: daelas
10 Replies
8. Shell Programming and Scripting
Hello Folks,
how to write a command on vi that allow to repeat last substitution command?
Here what I want to do :
1
2
3
1
2
3
1
2
3
:.,+2s/\n/ /And I obtain :
1 2 3
1
2
3
1 (5 Replies)
Discussion started by: gogol_bordello
5 Replies
9. Shell Programming and Scripting
hi;
my file1.txt:
cell137 1
cell337 1
cell355 1
cell355 3
cell360 1
cell360 2
cell360 3
my file2.txt:
...
cell137 1 20.64.1.97
cell137 2 20.64.1.97
cell137 3 20.64.1.97
...
cell337 1 20.64.1.113
cell337 2 20.64.1.113
cell337 3 20.64.1.113 (4 Replies)
Discussion started by: gc_sw
4 Replies
10. Shell Programming and Scripting
I am trying to find a way to repeat fields. I am not really sure how to explain it so let me just post a sample and what I want it to look like.
888123 66232 18 1
19
44422 11 7
23
881133 66231 33 1
34 ... (4 Replies)
Discussion started by: DerangedNick
4 Replies
LEARN ABOUT MOJAVE
io::digest
IO::Digest(3) User Contributed Perl Documentation IO::Digest(3)
NAME
IO::Digest - Calculate digests while reading or writing
SYNOPSIS
use IO::Digest;
# Get a Digest::MD5 object that takes input while $fh being written or read
my $fh;
my $iod = IO::Digest->new ($fh, 'MD5');
print $fh "fooo";
print $iod->hexdigest
DESCRIPTION
This module allows you to calculate digests while reading or writing file handles. This avoids the case you need to reread the same
content to compute the digests after written a file.
TEST COVERAGE
----------------------------------- ------ ------ ------ ------ ------ ------
File stmt branch cond sub time total
----------------------------------- ------ ------ ------ ------ ------ ------
blib/lib/IO/Digest.pm 100.0 n/a n/a 100.0 100.0 100.0
Total 100.0 n/a n/a 100.0 100.0 100.0
----------------------------------- ------ ------ ------ ------ ------ ------
AUTHORS
Chia-liang Kao <clkao@clkao.org>
COPYRIGHT
Copyright 2004 by Chia-liang Kao <clkao@clkao.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See <http://www.perl.com/perl/misc/Artistic.html>
perl v5.18.2 2013-02-16 IO::Digest(3)