1

I'm trying to get all the files which have 'load' in their names from a directory. I'm trying to do:

find -type f | sed -s 'load

However, I recurrently receive an error

sed: -e expression #1, char 1: unknown command: `f'

A worse part is that although I am able to manipulate regexes I 'm really bad at using grep/sed/awk, and this is slowing me down all the time. Whatever material I found online so far isn't great. Do you guys have any know of any comprehensive and fairly concise screencasts/tutorials? I still miss the skill to read and quickly understand linux manuals.

1 Answer 1

2

You don't need grep/sed/awk at all, let find filter the results for you:

find . -type f -name '*load*'

Or, in bash only

shopt -s globstar nullglob
load_files=( **/*load* )

if you do want an external tool:

find . -type f | grep load
find . -type f | awk '/load/'
find . -type f | sed -n '/load/p'

With the sed, use -n to suppress normal output, and only print for lines matching the pattern.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .