Sponsored Content
Top Forums Shell Programming and Scripting Awk: File Checking Issues with 9 multiple file Post 302909997 by siramitsharma on Monday 21st of July 2014 11:27:03 PM
Old 07-22-2014
Thaks Yoda, I have modified code as per below, but still the required output is not generated. Please throw some light

Code:
awk -F, -v ptime="201407" 'FNR==1
                        ARGV[1]==1 {KRL[$1]=$2;next}
                        ARGV[2]==2 {GUJ[$1]=$2;next}
                        ARGV[3]==3 {DEL[$1]=$2;next}
                        ARGV[4]==4 {UPW[$1]=$2;next}
                        ARGV[5]==5 {CHN[$1]=$2;next}
                        ARGV[6]==6 {KOL[$1]=$2;next}
                        ARGV[7]==7 {KTK[$1]=$2;next}
                        ARGV[8]==8 {RAJ[$1]=$2;next}
                        ARGV[9]==9 {ROWB[$1]=$2;next}
                        {
                                print $1,KRL[$1],GUJ[$1],DEL[$1],UPW[$1],CHN[$1],KOL[$1],KTK[$1],RAJ[$1],ROWB[$1],0,0,0,ptime,KRL[$1]+GUJ[$1]+DEL[$1]+UPW[$1]+CHN[$1]+KOL[$1]+KTK[$1]+RAJ[$1]+ROWB[$1]|"sort"
                        }' OFS="," ${pp_sms_rej_countfile[@]} "totalfilename" >>  consolidatelog

Output is as follows where duplicity is happening for each file & matching record is not getting printed accordingly
Code:
20140720113251.1265,1
20140720113251.1265,,,,,,,,,,,
20140720221959.5072,2
20140720221959.5072,,,,,,,,,,,
20140720123840.1673,3
20140720123840.1673,,,,,,,,,,,
20140720113629.1299,4
20140720113629.1299,,,,,,,,,,,
20140720204032.4580,5
20140720204032.4580,,,,,,,,,,,

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Checking Multiple file existence

Hi, I want to check multiple files exist or not in a single if statement in korn Shell:confused:. Please help me Thanks (1 Reply)
Discussion started by: lathish
1 Replies

2. Shell Programming and Scripting

Multiple file existence and checking file size

I want to check the files in particular directory are more that 0 Bytes i.e, Non zero byte file. The script should print a msg if all the files in that directory are empty( 0 Byte). (2 Replies)
Discussion started by: lathish
2 Replies

3. Shell Programming and Scripting

Checking a file using awk

I have a file that looks like this, with the first number in each block within each SOURCE declaration being a distance. %( PHASES P %) %( SOURCES (10,0.0) (13,0.0) (16,0.0) (19,0.0) (22,0.0) (25,0.0) (28,0.0) (31,0.0) (34,0.0) (37,0.0) (0 Replies)
Discussion started by: kristinu
0 Replies

4. Shell Programming and Scripting

Filtering issues with multiple columns in a single file

Hi, I am new to unix and would greatly appreciate some help. I have a file containing multiple colums containing different sets of data e.g. File 1: John Ireland 27_December_69 Mary England 13_March_55 Mike France 02_June_80 I am currently using the awk... (10 Replies)
Discussion started by: crunchie
10 Replies

5. Shell Programming and Scripting

Checking existence of file using awk

Hi, I need to check whether a particular file exists ot not using awk. Can anyone help me please? For Example:script that i am using: awk '{filename =$NF; rc=(system("test -r filename")) print $rc;}' "$1" is not working. Here I am passing a text file as input whose last word contains a... (6 Replies)
Discussion started by: manish007
6 Replies

6. Shell Programming and Scripting

Awk match multiple columns in multiple lines in single file

Hi, Input 7488 7389 chr1.fa chr1.fa 3546 9887 chr5.fa chr9.fa 7387 7898 chrX.fa chr3.fa 7488 7389 chr21.fa chr3.fa 7488 7389 chr1.fa chr1.fa 3546 9887 chr9.fa chr5.fa 7898 7387 chrX.fa chr3.fa Desired Output 7488 7389 chr1.fa chr1.fa 2 3546 9887 chr5.fa chr9.fa 2... (2 Replies)
Discussion started by: jacobs.smith
2 Replies

7. Shell Programming and Scripting

How to split file into multiple files using awk based on 1 field in the file?

Good day all I need some helps, say that I have data like below, each field separated by a tab DATE NAME ADDRESS 15/7/2012 LX a.b.c 15/7/2012 LX1 a.b.c 16/7/2012 AB a.b.c 16/7/2012 AB2 a.b.c 15/7/2012 LX2 a.b.c... (2 Replies)
Discussion started by: alexyyw
2 Replies

8. Shell Programming and Scripting

Issues in reading file using 'awk'

Dear all, I am using following function of some script to assign variable "JobNo" some value form file $SAMPLE"_status.log" ( generated using the red color command ) crab ntuplize_crab -status -c $SAMPLE >& $SAMPLE"_status.log" & echo $SAMPLE"_status.log" "=====" jobNo=$(awk... (10 Replies)
Discussion started by: emily
10 Replies

9. Shell Programming and Scripting

Checking Multiple File existance in a UNIX folder(Note: File names are all different)

HI Guys, I have some 8 files with different name and extensions. I need to check if they are present in a specific folder or not and also want that script to show me which all are not present. I can write if condition for each file but from a developer perspective , i feel that is not a good... (3 Replies)
Discussion started by: shankarpanda003
3 Replies

10. Shell Programming and Scripting

Checking File record equal to multiple of 70 or nearest number to multiple of 70

Hello, I have a file with below content - Example 3 6 69 139 210 345 395 418 490 492 I would like the result as - Multiple of 70 or nearest number in the file less than the multiple of 70 69 139 (5 Replies)
Discussion started by: Mannu2525
5 Replies
Perl::Critic::Policy::InputOutput::ProhibitExplicitStdinUser Contributed Perl DocumentaPerl::Critic::Policy::InputOutput::ProhibitExplicitStdin(3)

NAME
Perl::Critic::Policy::InputOutput::ProhibitExplicitStdin - Use "<>" or "<ARGV>" or a prompting module instead of "<STDIN>". AFFILIATION
This Policy is part of the core Perl::Critic distribution. DESCRIPTION
Perl has a useful magic filehandle called *ARGV that checks the command line and if there are any arguments, opens and reads those as files. If there are no arguments, *ARGV behaves like *STDIN instead. This behavior is almost always what you want if you want to create a program that reads from "STDIN". This is often written in one of the following two equivalent forms: while (<ARGV>) { # ... do something with each input line ... } # or, equivalently: while (<>) { # ... do something with each input line ... } If you want to prompt for user input, try special purpose modules like IO::Prompt. CONFIGURATION
This Policy is not configurable except for the standard options. CAVEATS
Due to a bug in the current version of PPI (v1.119_03) and earlier, the readline operator is often misinterpreted as less-than and greater- than operators after a comma. Therefore, this policy misses important cases like my $content = join '', <STDIN>; because it interprets that line as the nonsensical statement: my $content = join '', < STDIN >; When that PPI bug is fixed, this policy should start catching those violations automatically. CREDITS
Initial development of this policy was supported by a grant from the Perl Foundation. AUTHOR
Chris Dolan <cdolan@cpan.org> COPYRIGHT
Copyright (c) 2007-2011 Chris Dolan. Many rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module perl v5.16.3 2014-06-09 Perl::Critic::Policy::InputOutput::ProhibitExplicitStdin(3)
All times are GMT -4. The time now is 06:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy