Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9142253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:45:11+00:00 2026-06-17T09:45:11+00:00

Here is the line: find /localdir/ | grep ‘[0-9’]$ | xargs -i% cp %

  • 0

Here is the line:

find /localdir/ | grep '[0-9']$ | xargs -i% cp % /tftpboot

I specifically want to know what grep is looking for exactly here.
Can anyone translate it for me please ?

I am also kind of interested in what the xargs cmd is going to look like…

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:45:12+00:00Added an answer on June 17, 2026 at 9:45 am

    [0-9] means any character from 0 through 9. $ means the end of a line. So your grep will find any line (i.e., filename) that ends with a digit, and xargs will copy them each to /tftpboot.

    Of course, you’ll have some surprises if any of those filenames contain spaces. You can do this entirely within the shell in zsh (and I think in recent versions of bash):

    cp /localdir/**/*[0-9] /tftpboot
    

    addendum: If you’re asking about the funny quoting, that will work, though it’s not very human-friendly.

    The key is that you can have quoted strings and non-quoted strings right next to each other in shell, and they’ll become a single string; echo "fo"ob'ar' will produce foobar.

    The first part is quoted because [ is special to bash. ] is also special, but since bash never saw a special (unquoted) [, it leaves the ] alone. $ would normally substitute a variable, but nothing comes after it, so bash leaves that alone too.

    The string that actually gets passed to grep is still [0-9]$.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know, I am propably way out of line here :-) I want to
Here's the situation. function scrollLog(line) { // Assume Firefox // alert(weird); frames['log'].find(line); }; Here's
In the W3C working draft for HTML5 here's a line I find confusing: http://www.w3.org/TR/html5/introduction.html#html-vs-xhtml
Recently I came across command line to find damaged JPEG here at http://www.commandlinefu.com/commands/view/2352/find-corrupted-jpeg-image-files .
I want to open file add 4 underline character to beginning of line find
Here's the line from App.Config: <add key=CheckFileFormatString value=P{0}\t&quot;{1}, {2}&quot;\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t{9}\t{10}/> Here's the code that puts
I’m trying to validate input by using egrep and regex.Here is the line from
I am getting a Wrong type argument: commandp, (lambda nil (forward-line 5)) here. (global-set-key
Here is a command line script for a dictionary lookup using Wordnet: #!/bin/bash #
here is my current line of code: $(<li>).text($(this).text()).appendTo(#theList); Which results in <ul id=theList> <li>blah</li>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.