| Author |
Combining three short awk scripts
|
|
| shalomkeren@yahoo.com 2006-12-11, 7:00 pm |
| Hi
I'm trying to change a report file format. And then compare it with
other file and then delete the lines that are equal.
The report is a combination of info's and warnings
I wrote three short commands and now I need to combine them all
together
Any suggestions?
I need to compare the file warning_1 with file_2 if the line in file_2
exits on file warning_1 I need to delete it from the warning_1
Any suggestions?
this are the three commands
awk '{for(i=0;i<13958;i++){{getline temp "modem_x_ver2.txt"};\
{if (temp ~ /Synthesizing/) {getline temp1<"modem_x_ver2.txt";\ {if
(temp1 ~ /Related/) {getline temp2 <"modem_x_ver2.txt";\ {if (temp2 ~
/WARNING/) {while (temp2 ~/WARNING/) {printf temp " " temp2 "\n"
>"warning_1.txt"; getline temp2 < "modem_x_ver2.txt"}}}}}}}}exit}
awk '/Loading/,/Number of infos/' modem_x_ver2.txt > warning_part2.txt
awk '/WARNING/' warning_part2.txt >> warning_1.txt
Thanks for the help
I just started with awk so ...
keren
| |
| Ed Morton 2006-12-11, 7:00 pm |
| shalomkeren@yahoo.com wrote:
> Hi
>
> I'm trying to change a report file format. And then compare it with
> other file and then delete the lines that are equal.
>
> The report is a combination of info's and warnings
>
> I wrote three short commands and now I need to combine them all
> together
> Any suggestions?
>
> I need to compare the file warning_1 with file_2 if the line in file_2
> exits on file warning_1 I need to delete it from the warning_1
> Any suggestions?
>
>
> this are the three commands
> awk '{for(i=0;i<13958;i++){{getline temp "modem_x_ver2.txt"};\
> {if (temp ~ /Synthesizing/) {getline temp1<"modem_x_ver2.txt";\ {if
> (temp1 ~ /Related/) {getline temp2 <"modem_x_ver2.txt";\ {if (temp2 ~
> /WARNING/) {while (temp2 ~/WARNING/) {printf temp " " temp2 "\n"
>
You don't really expect anyone to waste their time trying to underrstand
the above, do you? Come on - format it to be readable rather than asking
everyone else to. Also at least post some sample input and expected output.
Ed.
[color=darkred]
>
> awk '/Loading/,/Number of infos/' modem_x_ver2.txt > warning_part2.txt
>
> awk '/WARNING/' warning_part2.txt >> warning_1.txt
>
>
>
>
> Thanks for the help
> I just started with awk so ...
>
> keren
>
| |
| Kenny McCormack 2006-12-11, 7:00 pm |
| In article <YuKdnYCt7fB7-ODYnZ2dnUVZ_oOonZ2d@comcast.com>,
Ed Morton <morton@lsupcaemnt.com> wrote:
....
>You don't really expect anyone to waste their time trying to underrstand
>the above, do you? Come on - format it to be readable rather than asking
>everyone else to. Also at least post some sample input and expected output.
Indeed. I was going to be a little more polite and suggest:
Start over from scratch (as the posted material is gibberish)
but I like your version better.
| |
| shalomkeren@yahoo.com 2006-12-11, 7:00 pm |
| Hi
I'm sorry I will try again and spilt the problem::
I have a Reports files named "warning_1" with warnings that I need to
check and I have File named "warning_checked" that contain warnings I
already checked before.
I need to delete the warnings that appears in the "warning_checked"
file from the reports files "warning_1" ::
file warning_1.txt look like this::
Synthesizing Unit <add_round_truncate>. WARNING:Xst:1780 - Signal
<tempout> is never ..
Synthesizing Unit <normalizer>. WARNING:Xst:646 - Signal
<big_small<14:0>> is ...
Synthesizing Unit <normalizer>. WARNING:Xst:646 - Signal
<muxout_2<12:11>> is ...
WARNING:Xst:646 - Signal <add_29_out_1<16>> is assigned but never used.
WARNING:Xst:646 - Signal <add_29_out_3<16>> is assigned but never used.
WARNING:Xst:646 - Signal <add_29_out_4<15:0>> is assigned but never
used.
WARNING:Xst:646 - Signal <mul_17_out_2<16>> is assigned but never used.
WARNING:Xst:646 - Signal <mul_22_out_2<16>> is assigned but never used.
WARNING:Xst:646 - Signal <mul_17_out_3<16>> is assigned but never used.
WARNING:Xst:646 - Signal <mul_22_out_3<16>> is assigned but never used.
WARNING:Xst:646 - Signal <mul_17_out_4> is assigned but never used.
"warning_checked.txt" look the like this::
Synthesizing Unit <add_round_truncate>. WARNING:Xst:1780 - Signal
<tempout> is never ..
Synthesizing Unit <normalizer>. WARNING:Xst:646 - Signal
<big_small<14:0>> is ...
WARNING:Xst:646 - Signal <mul_17_out_3<16>> is assigned but never used.
WARNING:Xst:646 - Signal <mul_17_out_2<16>> is assigned but never used.
WARNING:Xst:646 - Signal <mul_22_out_2<16>> is assigned but never used.
expected result ::
Synthesizing Unit <normalizer>. WARNING:Xst:646 - Signal
<muxout_2<12:11>> is ...
WARNING:Xst:646 - Signal <add_29_out_1<16>> is assigned but never used.
WARNING:Xst:646 - Signal <add_29_out_3<16>> is assigned but never used.
WARNING:Xst:646 - Signal <add_29_out_4<15:0>> is assigned but never
used.
WARNING:Xst:646 - Signal <mul_22_out_3<16>> is assigned but never used.
WARNING:Xst:646 - Signal <mul_17_out_4> is assigned but never used.
| |
| Ed Morton 2006-12-11, 7:00 pm |
| shalomkeren@yahoo.com wrote:
> Hi
> I'm sorry I will try again and spilt the problem::
>
> I have a Reports files named "warning_1" with warnings that I need to
> check and I have File named "warning_checked" that contain warnings I
> already checked before.
>
> I need to delete the warnings that appears in the "warning_checked"
> file from the reports files "warning_1" ::
>
> file warning_1.txt look like this::
>
> Synthesizing Unit <add_round_truncate>. WARNING:Xst:1780 - Signal
> <tempout> is never ..
> Synthesizing Unit <normalizer>. WARNING:Xst:646 - Signal
> <big_small<14:0>> is ...
> Synthesizing Unit <normalizer>. WARNING:Xst:646 - Signal
> <muxout_2<12:11>> is ...
> WARNING:Xst:646 - Signal <add_29_out_1<16>> is assigned but never used.
> WARNING:Xst:646 - Signal <add_29_out_3<16>> is assigned but never used.
> WARNING:Xst:646 - Signal <add_29_out_4<15:0>> is assigned but never
> used.
> WARNING:Xst:646 - Signal <mul_17_out_2<16>> is assigned but never used.
> WARNING:Xst:646 - Signal <mul_22_out_2<16>> is assigned but never used.
> WARNING:Xst:646 - Signal <mul_17_out_3<16>> is assigned but never used.
> WARNING:Xst:646 - Signal <mul_22_out_3<16>> is assigned but never used.
> WARNING:Xst:646 - Signal <mul_17_out_4> is assigned but never used.
>
>
> "warning_checked.txt" look the like this::
>
> Synthesizing Unit <add_round_truncate>. WARNING:Xst:1780 - Signal
> <tempout> is never ..
> Synthesizing Unit <normalizer>. WARNING:Xst:646 - Signal
> <big_small<14:0>> is ...
> WARNING:Xst:646 - Signal <mul_17_out_3<16>> is assigned but never used.
> WARNING:Xst:646 - Signal <mul_17_out_2<16>> is assigned but never used.
> WARNING:Xst:646 - Signal <mul_22_out_2<16>> is assigned but never used.
>
>
> expected result ::
>
> Synthesizing Unit <normalizer>. WARNING:Xst:646 - Signal
> <muxout_2<12:11>> is ...
> WARNING:Xst:646 - Signal <add_29_out_1<16>> is assigned but never used.
> WARNING:Xst:646 - Signal <add_29_out_3<16>> is assigned but never used.
> WARNING:Xst:646 - Signal <add_29_out_4<15:0>> is assigned but never
> used.
> WARNING:Xst:646 - Signal <mul_22_out_3<16>> is assigned but never used.
> WARNING:Xst:646 - Signal <mul_17_out_4> is assigned but never used.
>
awk 'NR==FNR{chkd[$0];next}!($0 in chkd)' warning_checked warning1
Ed.
|
|
|
|