Open all files with a regular expression in vim

vim $(grep [REGULAR_EXPRESSION] -R * | cut -d":" -f1 | uniq)

0
2012-11-07 19:30:24

These Might Interest You

  • This is a slight variation of an existing submission, but uses regular expression to look for files instead. This makes it vastly more versatile, and one can easily verify the files to be kept by running ls | egrep "[REGULAR EXPRESSION]"


    -1
    ls | egrep -v "[REGULAR EXPRESSION]" | xargs rm -v
    Saxphile · 2010-04-01 02:40:40 1
  • Get all URLs from website via Regular Expression... You must have lynx installed in your computer to execute the command. --> lynx --dump "" | egrep -o "" - Must substitute it for the website path that you want to extract the URLs - Regular Expression that you wanna filter the website Show Sample Output


    0
    lynx --dump "http://www.google.com.br" | egrep -o "http:.*"
    felipelageduarte · 2011-09-05 01:12:15 0
  • This is usefull when we don't know the exact name of the process, but the application name A limitation is that the regular expression only tries to match the last part of the full command (i.e. the bin file name itself). But this is way shorter than the following one: ps axww | grep SomeCommand | awk '{ print $1 }' | xargs kill Show Sample Output


    0
    killall -r 'a regular expression'
    dexterhu · 2011-03-07 07:29:42 2
  • Place the regular expression you want to validate between the forward slashes in the eval block. Show Sample Output


    4
    perl -we 'my $regex = eval {qr/.*/}; die "$@" if $@;'
    tlacuache · 2009-10-13 21:50:47 1

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: