Skip to content
Archive of posts tagged grep

Pulling out strings

Some ways to "pull out" strings from files

“Zero or more”

This usually comes up in a form similar to "I'm running this code: $ echo "foobar 123" | sed 's/[0-9]*/blah/' blahfoobar 123 but I don't get the expected result!" (which they think should be "foobar blah"). The result they get is instead as shown above. Why is that? Remember that the star quantifier "*" means […]

Run a command on all files in a hierarchy

Something that everybody needs to do sooner or later.

Find files containing specific words

Print the names of the files that contain some set of words