-3

I have some folders like:

SRGRG-3DDD-E7DHC-VUDND4-8
EHFAWFH-AWF8WF-WF74H4-G9799
HDSRJ86-FJJ-SU8USH-DYYDCJ0

Inside them some files like:

file1
file2
file3

I am on a Linux environment. How can I use a find on the command line with a regex to find the file paths. So for file1 I get this path SRGRG-3DDD-E7DHC-VUDND4-8 And so on

(I know the file names. Just need their paths)

IT ISN'T A DUPLICATE. I NEED SOMETHING DIFFERENT, SPECIFIC TO WHAT I WANT

  • Possible duplicate of [How to use regex with find command?](http://stackoverflow.com/questions/6844785/how-to-use-regex-with-find-command) – wake-0 Dec 23 '16 at 21:02
  • In other words, you need someone to write it for you. This is not a good way to learn and will ensure that you forever remain 'NEW TO THIS'. Why not try yourself and then post a specific question for when you get stuck? – David Rawson Dec 23 '16 at 23:25

1 Answers1

0

No regex needed, just use the name option:

find -name file1 -o -name file2 -o -name file3

Or, use a pattern:

find -name 'file[123]'

Regexes match the whole path, so you need to prefix it with .*:

find -regex '.*/file[123]'
choroba
  • 231,213
  • 25
  • 204
  • 289
  • Will this work if the file is inside a subdirectory? – Jakea Hacks Dec 23 '16 at 21:08
  • What exactly have you tried? What are the real paths and filenames? – choroba Dec 23 '16 at 21:17
  • The paths are UUID's of apps. Inside the paths are some other paths (Library/Preferences) and inside Preferences is located a file that has the app name (I am talking about iOS apps, on a jailbroken phone) – Jakea Hacks Dec 23 '16 at 21:19