Sponsored Content
Top Forums Shell Programming and Scripting Check if file is present using input from another file Post 302759945 by alex2005 on Wednesday 23rd of January 2013 06:28:47 AM
Old 01-23-2013
Hi,
Thank you for your reply,
In order to get it working I have done the next adjustments (also I have added a listing of missing serials from input):

Code:
find /logs -type f -print | awk '
FNR==NR{if ($1!="ID") S[$2]; next}
{
  if($2 in F) {
    F[$2]=F[$2]", "$3"_"$4"_"$5
    D[$2]=F[$2] }
  else F[$2]=$3"_"$4"_"$5
}
!($2 in S) {
   system("mkdir -p /missing/"$3)
   system("mv "$0" /missing/"$3"/")
print " Missing serials: " $2
}
END {
   for(serial in S) { count++ }
   for(serial in F) { found++ }
   print "Serials: " count " Matched: " found " Files: "FNR
   for(serial in D) {
      print serial": " D[serial]
    }  

}' FS=, /statistics/support/input.txt FS='[_.]' - > /statistics/support/statistics.log

Best Regards
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Unix Shell Scripting -- update employees not present in input file

ALL, My shell script takes a employee file as input. I have to identify the list of employees not in the input file and update their status in the database. Approach I followed: by traversing through the input file add all the emplid's to a variable. update the status of employees not in... (2 Replies)
Discussion started by: sailussr
2 Replies

2. Shell Programming and Scripting

How to Check whether list file present in TXT file exist or not

Hi All, I have txt file which has list of files. I have to check whether these files exist or not. Thanks supriya (6 Replies)
Discussion started by: supriyabv
6 Replies

3. Shell Programming and Scripting

check presence of input file

My script is taking a file "input.in" as input for running the script. My worry is that i need to execute the script only if the file is present, if it's not don't perform the next commands. Just to have a check at the beginning of the script : If "input.in" exists, then go on. If it's does not... (4 Replies)
Discussion started by: newpromo
4 Replies

4. Shell Programming and Scripting

How to check field formatting of input file?

Hi, I had input file with below data, abcdefghij;20100903040607;1234567891;GLOBAL; Having values of fields with seperated by semi-colon (;) and ended with line feed (\n). Through shell script, how can I check the field formatting? Thanks in advance. (18 Replies)
Discussion started by: Poonamol
18 Replies

5. Shell Programming and Scripting

Input file check

Hi, I have a script which runs daily. It gets 3 input files test1,test2,test3. I want to do a validation in my script to make sure i have all the 3 files available before running. If any one of the file is missing i want to break the script. Could you please help me with this request. ... (1 Reply)
Discussion started by: Krrishv
1 Replies

6. Shell Programming and Scripting

Delete a pattern present in file 2 from file 1 if found in file 1.

I have two files File1 ==== 1|2000-00-00|2010-02-02|| 2| 00:00:00|2012-02-24|| 3|2000-00-00|2011-02-02|| File2 ==== 2000-00-00 00:00:00 I want the delete the patterns which are found in file 2 from file 1, Expected output: File1 ==== (5 Replies)
Discussion started by: machomaddy
5 Replies

7. Shell Programming and Scripting

Check input file with different criteria

HI Input file.txt ABCDE1 JFHFJFJF3 10 ABCDE2 JFHFJFJF5 20 ABCDE3 JFHFJFJF5 30 ABCDE4 JFHFJFJF6 - ABCDE5 JFHFJFJF6 20 ABCDE6 JFHFJFJF6 90 ABCDE7 JFHFJFJF6 9 ABCDE8 JFHFJFJF6 I want to check third column if data missing or wrong data the echo massage and out from script. 1.... (8 Replies)
Discussion started by: pareshkp
8 Replies

8. Shell Programming and Scripting

Check if 2 input values exists in a file

I have a file number.txt.I need to get 2 inputs from the terminal like a=100 and b=200.If a and b are there in the file,then check if a < b,print "less".If a is not there in the file,print "a is missing" or if b is not there in the file,print "b is missing". number.txt: 100 200 300 (2 Replies)
Discussion started by: aneeta13
2 Replies

9. Shell Programming and Scripting

Systemd errors of missing file “No such file or directory” inspite of file being present

The contents of my service file srvtemplate-data-i4-s1.conf is Description=test service for users After=network.target local-fs.target Type=forking RemainAfterExit=no PIDFile=/data/i4/srvt.pid LimitCORE=infinity EnvironmentFile=%I . . . WantedBy=multi-user.target (0 Replies)
Discussion started by: rupeshkp728
0 Replies
Blt_TreeGetNode(3)					      BLT Library Procedures						Blt_TreeGetNode(3)

__________________________________________________________________________________________________________________________________________________

NAME
Blt_TreeGetNode - Finds the node from the ID. SYNOPSIS
#include <bltTree.h> Blt_TreeNode Blt_TreeGetNode(tree, number) ARGUMENTS
Blt_Tree tree (in) Tree containing the requested node. unsigned int number (in) Serial number of the requested node. _________________________________________________________________ DESCRIPTION
This procedure returns a node in a tree object based upon a give serial number. The node is searched using the serial number. The arguments are as follows: tree The tree containing the requested node. number The serial number of the requested node. RETURNS
The node represented by the given serial number is returned. If no node with that ID exists in tree then NULL is returned. EXAMPLE
The following example gets the node from a serial number. unsigned int number; Blt_TreeNode node; Blt_TreeToken token; node = Blt_TreeGetNode(token, number); if (node == NULL) { printf("no node with ID %d exists ", number); } else { printf("node found: label is %s ", Blt_TreeNodeLabel(node)); } KEYWORDS
Tcl_TreeCreateNode, Tcl_TreeDeleteNode BLT
2.4 Blt_TreeGetNode(3)
All times are GMT -4. The time now is 03:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy