0

I'm trying to grep for missing values in an unzipped powerpoint doc. I'm using this line in my script:

for s in *.xml; do grep -L ppaction://media "$SLIDE_PATH/${s}" | grep -o -E '[0-9]+'; done

the script kicks an error:

grep /genetics/ppt/slides/: No such file or directory
grep: *.xml: No such file or directory

yet that line works fine when run from the terminal. Any ideas what I'm doing wrong here?

4
  • I'm guessing $SLIDE_PATH is set in your terminal but not in whatever shell you are using in your script Commented May 14, 2021 at 15:06
  • I get a similar error if I remove $SLIDE_PATH and hard code the path- /genetics/ppt/slides/*.xml: No such file or directory Commented May 14, 2021 at 15:23
  • Does the path exist and do you have all permissions? Commented May 14, 2021 at 16:12
  • path exists and owned by my account Commented May 14, 2021 at 17:48

1 Answer 1

1

Start by checking what you have.

echo *.xml # should list your files

If this outputs *.xml you're in the wrong place.
Try it this way:

for s in "$SLIDE_PATH"/*.xml
do grep -L ppaction://media "$s" | grep -o -E '[0-9]+'
done

Does that work any better?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.