Sponsored Content
Full Discussion: Identify missing file
Top Forums Shell Programming and Scripting Identify missing file Post 302988980 by Don Cragun on Friday 6th of January 2017 03:28:40 AM
Old 01-06-2017
Quote:
Originally Posted by dsravanam
I am on linux and I am supposed to receive 3 files. If any of the files are not received I need to identify the missing file and throw it out in a variable.

I have put in something like this

Code:
if [[ -a $file1 ]]
    then echo "file $file1 was found"
else
    echo "ERROR: file $file1 was not found!!!"
      #####  set a variable here ##############
       fi

if [[ -a $file2 ]]
    then echo "file $file2 was found"
else
    echo "ERROR: file $file2 was not found!!!"
 #####  set a variable here ##############
               
fi

if [[ -a $file3 ]]
    then echo "file $file3 was found"
else
    echo "ERROR: file $file3 was not found!!!"
                #####  set a variable here ##############

Is there a way I can capture each file in a variable and throw out the missing file after all the checks are completed?
What do you mean by "capture each file in a variable"? You already have each file's pathname in a variable. You can't put the contents of a file that was not found in a variable (unless you just want to set a variable to an empty string).

I assume that you are asking for our help in setting variables (since you have put those comments in bold text), but I have no idea what you intend to do with those variables???

How do you "throw out the missing file"? If a file is missing isn't it already gone???
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Identify type of file

hi all, i have the next question: how can i identify the type of a file? . I'm working in Unix (Solaris 5.7) and i would like identify if a file is or not is a "flat file". I need have a program what separates the flat file in a directory, and the excel file in another directory. I must get... (1 Reply)
Discussion started by: DebianJ
1 Replies

2. Shell Programming and Scripting

how to identify the mode of the file in unix

hi, I have a requirement in that i need to process a input file The problem is, the input file sometimes it is coming in dos mode and some times it is coming in unix mode The script which i have written will process the file only if it is in unix mode and it is not processing if the file is in... (7 Replies)
Discussion started by: trichyselva
7 Replies

3. UNIX for Dummies Questions & Answers

Identify File with ControlM Characters

Dear Members, I have a file which contains ControlM characters in it. I need a command by the means of which i should be able to identify if a file has controlM characters. How can this be achieved. Thanks Sandeep (4 Replies)
Discussion started by: sandeep_1105
4 Replies

4. UNIX for Dummies Questions & Answers

Identify a file for encryption or decryption

Dear Members, Can we find if a particular file is encrypted or decrypted. I need a command by which i should be able to identify if a file is encrypted or decrypted. How can we do this? (1 Reply)
Discussion started by: sandeep_1105
1 Replies

5. Shell Programming and Scripting

Identify age of the file.

Hi all, I'm using SunOS. need to find age of the file in terms of seconds. The file name with its path will be given to the script as input. Any kinda help will be appreciated. Thanks in advance (7 Replies)
Discussion started by: bankimmehta
7 Replies

6. Shell Programming and Scripting

Identify missing VGs

lsvg command returns rootvg mqB01vg heartbeatvg mqA01vg oracleAvg2 cevgA01 orastgevg ..... lsvg -o command returns rootvg mqB01vg heartbeatvg mqA01vg oracleAvg2 ...... (3 Replies)
Discussion started by: Daniel Gate
3 Replies

7. Shell Programming and Scripting

Compare large file and identify difference in separate file

I have a very large system generated file containing around 500K rows size 100MB like following HOME|ALICE STREET|3||NEW LISTING HOME|NEWPORT STREET|1||NEW LISTING HOME|KING STREET|5||NEW LISTING HOME|WINSOME AVENUE|4||MODIFICATION CAR|TOYOTA|4||NEW LISTING CAR|FORD|4||NEW... (9 Replies)
Discussion started by: jubaier
9 Replies

8. Shell Programming and Scripting

Identify file name pattern in different file names

Hi, need help in recognizing the pattern of file name. For e.g. file name 1: <static file prefix>.<store cd>_<YYYYMMDD>.<ext> file name 2: <static file prefix>_<YYYYMMDD>.<ext> I want to know that there are 3 dots "." in the file name1 and one dot "." in file name2. How can I know... (3 Replies)
Discussion started by: dips_ag
3 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

10. Shell Programming and Scripting

Identify the Parameter variable file

Hi I am trying to understand a shell scipt file ( .ksh file ) . In the shell script we are referring a variable . Example : SessLogs=$STAFF_MSTR_DIR/staff_dtls There are no references in the shell script from where the variable "$STAFF_MSTR_DIR" is being read from . Could anyone... (2 Replies)
Discussion started by: Sudheer Maddula
2 Replies
MAKE-LINGUA-IDENTIFY-LANGUAGE(1p)			User Contributed Perl Documentation			 MAKE-LINGUA-IDENTIFY-LANGUAGE(1p)

NAME
make-lingua-identify-language - creates language modules for Lingua::Identify SYNOPSIS
make-lingua-identify-language Language-Tag Language-Name file1 [file2 ...] or make-lingua-identify-language -d TAG1-LANGUAGE1/ [TAG2-LANGUAGE2/ ...] or make-lingua-identify DESCRIPTION
Creates language modules to be used by Lingua::Identify. After creating the modules, you still have to install them. Please note that this script is still at an early stage. Please do not even look at the code... Without parameters, make-lingua-identify-language assumes mode -d and goes through all the directories in the current one. This is useful to be used in a directory where you something like this: . |-- en-english | `-- english.txt |-- fr-french | `-- french1.txt | `-- french2.txt `-- pt-portuguese `-- portuguese.txt OPTIONS -d Directory mode. Each parameter passed should be a directory whose name must be of the form tag-name (e.g., en-english/ ). Each of the directories passed should contain text files that can be used to train Lingua::Identify. -D Debug mode. Only for development. -h Display help and exit. -v Show version and exit. -verbose Verbose mode. -locale="<locale>" Set a specific locale. This way your text will be all lowercased before analysed. META.yml "META.yml" files are not parsed as other files, they are ignored. In directory mode ("-d" switch), "META.yml" files are checked for info on languages codes and sets. Here's a simple "META.yml" for you to put in your directories: two_letter_code: pt three_letter_code: por sets: spoken_in_portugal With that, the language will be identified with the two letter code "pt" or the three letter code "por"; it will also be in the set ":spoken_in_portugal". CONTRIBUTING WITH NEW LANGUAGES
Please do not contribute with modules you made yourself. It's easier to contribute with unprocessed text, because that allows for new versions of Lingua::Identify not having to drop languages down in case I can't contact you by that time. Use make-lingua-identify-language to create a new module for your own personal use, if you must, but try to contribute with unprocessed text rather than those modules. SEE ALSO
Lingua::Identify(3), langident(1) A linguist and/or a shrink. The latest CVS version of "Lingua::Identify" (which includes make-lingua-identify) can be attained at http://natura.di.uminho.pt/natura/viewcvs.cgi/Lingua/Identify/ ISO 639 Language Codes, at http://www.w3.org/WAI/ER/IG/ert/iso639.htm AUTHOR
Jose Alves de Castro, <cog@cpan.org> COPYRIGHT AND LICENSE
Copyright 2004-2005 by Jose Alves de Castro This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-01-02 MAKE-LINGUA-IDENTIFY-LANGUAGE(1p)
All times are GMT -4. The time now is 02:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy