shell script urgent help

I have the following command

find /dir/directory1/DEV.pdf -type f -exec cksum {} \; >> file.txt 2>&1

I want to read all file paths in bold from input.txt

content of input.txt

Following command is not working for me

find `cat input.txt` -type f -exec cksum {} \; >> file.txt 2>&1

Is there any alternative ...? I am getting "No such file or directory"
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Did you really use backticks around the cat command as posted?

Please try using $(  ) instead of ` `:

find $(cat input.txt) -type f -exec cksum {} \; >> file.txt 2>&1

If still no luck please make sure that all the directories listed in input.txt really exist:

xargs -I{} ls -d {} >/dev/null < input.txt

Any "not found" messages?
CalmSoulAuthor Commented:
I think problem is NAS path in input file ... It's a mount point path...
If correctly mounted NAS directories shouldn't cause any problem.

To silently skip missing directories use

find $(cat input.txt) -type f -exec cksum {} \; >> file.txt 2>/dev/null
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

Gerwin Jansen, EE MVETopic Advisor Commented:
Can you try this instead:

for a in $(cat input.txt)
  echo chksum "$a" >> file.txt 2>&1

Open in new window

If you see a list of chksum commands with filenames then remove the echo.
The problem is your input file is a list of files and their directories.  The find command is used to FIND files, you already know where they are since you have their path and names in the file.

Just run the following to get the checksum for each file:

for i in `cat input.txt`; do cksum $i; done

Open in new window

Shouldn't make a difference.
"find" can accept a path/filename combo as its path parameter.
That's rather uncommon and expensive, but it works.

On the other hand, Linux' cksum does not work against directories (Unix' cksum generally does).

So using "find" allows running cksum against a mix of pure paths and path/filename combos in input.txt without errors (if all elements in input.txt exist, that is).

If, and only if, input.txt contains just filenames you can simply use

cksum $(<input.txt) >> file.txt 2>&1

or, for a huge number of entries listed in input.txt:

xargs cksum < input.txt >> file.txt 2>&1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.