H
H
HitGirl2020-11-19 15:02:59
linux
HitGirl, 2020-11-19 15:02:59

Why is grep not filtering input?

Hello!
I'm trying to list all files with permissions, but grep, instead of listing lines that match the regular expression, just highlights the first character in those lines in red. Can you please tell me how to get a list of files without "total", empty lines and directory names?
ls -ARl $HOME | grep '^[-dbscpl]*'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2020-11-19
@HitGirl

ls -ARl $HOME | grep '^[-dbscpl]'
In your expression, '*' - means "zero or more" matches from the bracket - accordingly, almost all output falls under your regular expression

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question