Skip to content

Instantly share code, notes, and snippets.

@mikaelz
Created November 28, 2024 08:07
Show Gist options
  • Save mikaelz/92476739e6c4d497d16199f393ad2768 to your computer and use it in GitHub Desktop.
Save mikaelz/92476739e6c4d497d16199f393ad2768 to your computer and use it in GitHub Desktop.
Linux CLI oneliner to read paths from file and test if they exist

Linux list paths from file

List line from files one by one

while IFS= read -r line; do echo "$line"; done < /tmp/paths.csv

Test if file path from file exists

while IFS= read -r line; do test -e "$line" && echo "$line" exists || echo "$line" not found; done < /tmp/paths.csv | grep 'not found'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment