Reputation: 4015
Let's say I already have the output of an 'ls -la' command and I now want to parse out just the filenames. I have this regular expression so far that I found, but how can I modify this to account for there being whitespace in the filename itself?
Example 'ls -la' output:
-rw-r--r-- 1 admin staff 460340057 May 4 14:19 test_large_file.xml
Regular Expression I have so far:
\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+(\S+)
Upvotes: 1
Views: 496
Reputation: 99001
You can use something like:
/^.*\d\s+(.*?)$/m
https://regex101.com/r/mR4rH1/1
Upvotes: 1