Link to home
Start Free TrialLog in
Avatar of lolaferrari
lolaferrariFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Pattern matching error

I have a directory with a list of machine names  and some with domain names and some without. I want to check a file in each <machine>/sub dir. My hostlist only has the machine name without a FQDN

For i in cat hostlist; do cat $i*/file;fi; done ( it will not see the file with this wildcard - not sure how to cat tried cat ^$i but still didn't work.

The directory looks like this:
Machine1/file
Machine.my.domain.com/file
Machine.specialdomain.net/file
Machine2/file
ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lolaferrari

ASKER

Thank you for the fast response!
Avatar of Tintin
Tintin

If your original code looked like

for i in $(cat hostlist)
do
   cat $i*/file
done

Open in new window


then that would work just fine.