Check if 10 files exist

Hi All,

Whenever i get 10 files(file names like sales*) then another file need to create.
May i know how to implement this in KSH.

Not enough information.

How do you receive the files?

What system are you on? Which version of ksh are you using - ksh88 or ksh93? Hint:

echo $KSH_VERSION

will echo nothing if you are in ksh88.

Is this a homework question?

Andrew

Welcome siddireddy,

I have a few to questions pose in response first:-

  • Is this homework/assignment? There are specific forums for these.
  • What have you tried so far?
  • What output/errors do you get?
  • What OS and version are you using?
  • What are your preferred tools? (C, shell, perl, awk, etc.)
  • What logical process have you considered? (to help steer us to follow what you are trying to achieve)

Most importantly, What have you tried so far?

There are probably many ways to achieve most tasks, so giving us an idea of your style and thoughts will help us guide you to an answer most suitable to you so you can adjust it to suit your needs in future.

We're all here to learn and getting the relevant information will help us all.

Kind regards,
Robin

This is really homework,I want to explore in shell

I did research but could not able to find the exact answer.

If i know the filenames then,I can use like below

if[-e f1.txt -a -e f2.txt -a -e f3.txt -a -e f4.txt -a -e f5.txt -a -e f6.txt -a -e f7.txt -a -e f8.txt -a -e f8.txt -a -e f9.txt -a -e f10.txt];then
cat f1.txt,f2.txt,f3.txt,f4.txt,f5.txt,f6.txt,f7.txt,f8.txt,f9.txt,f10.txt>final.txt
else
echo file not exists
fi

If the filenames like f_date,then would like give f_* but when even 1 file is available then it will create a file.

So would like to mention some where if 10 files came then only need to create new file.

Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.