Link to home
Start Free TrialLog in
Avatar of libertyforall2
libertyforall2Flag for United States of America

asked on

If /path/file1.txt has 0 data replace with /path/genericfile.txt using shell script or perl on a linux box

I'm running a matlab script at it will not create ANY graphics unless ALL of the files contain data. As a result, I need to replace files that occasionally lack to with dummy data so the remaining output graphics can be generated so I need to do this.

If /path/file1.txt has 0 data replace with /path/genericfile.txt using shell script or perl on a linux box
ASKER CERTIFIED SOLUTION
Avatar of Pieter Jordaan
Pieter Jordaan
Flag of South Africa 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
SOLUTION
Avatar of woolmilkporc
woolmilkporc
Flag of Germany 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
Sorry of course it's the other way!

[ -s /path/file1.txt ] && cp -p /path/genericfile.txt /path/file1.txt

wmp
Avatar of libertyforall2

ASKER

Works.