|
#1
|
||||
|
||||
|
I have a problem, and I'm hoping someone here has the answer...
I have a list of files, one filename per line, in a text file titled "files.txt". I want to use this file as an *input list* for a "batch copy" command. In DOS, you could do this with the batch commands, similar to: FOR %%A IN "files.txt" DO BEGIN COPY %%A ../path/ NEXT (Or something like that. I forget the exact command syntax.) But I need the linux equivalent, and have Googled until I'm blue in the face. I suspect my search terms aren't quite right. Does anyone know the command syntax for that? I'm lost. ![]() Thanks in advance.
__________________
In ancient Rome, the word "Actor" meant "Prostitute". Mankind seems to have forgotten this. |
|
#2
|
||||
|
||||
|
Mark, if I point you towards the answer will you promise to ask in the right category next time? This one is for offering or seeking PAID services.
First, have you checked the excellent thread in our own dedi category? Basic To Advanced Linux Commands - HostGator Peer Support Forums Also: Linux Commands - A practical reference The humble Linux cheat sheet Linux Command -Line Syntax Reference List And, for your immediate purposes: DOS to Linux Cheat Sheet Linux Cheat Sheet for Mac and Windows Programmers - MDC
__________________
Hosting term analogies, revised and improved (?) Last edited by gwyneth; 08-02-2009 at 06:15 PM. |
|
#3
|
||||
|
||||
|
Well... the forum description doesn't say anything about "paid services".
"Use this forum to request or offer special services from your fellow users. Things such as graphic design, custom scripting, etc. See inside for more info." (bold emphasis mine) Perhaps the description can be amended to say so? While I appreciate the links, and will check them out, I was hoping someone would just reply with a simple example. Google was a dead-end but, as I said, the search terms I used may have been to blame. A moderator is welcome to move the post. Thanks, Gwen.
__________________
In ancient Rome, the word "Actor" meant "Prostitute". Mankind seems to have forgotten this. |
|
#4
|
||||
|
||||
|
OK, I'm sorry to provoke a Monday morning response. It was to get more answers from the 'nixperts, who might not check this category or the thread headline.
You want to grep: grep "*" filename(s) * can be a literal string (no spaces unless you want them in the search), or a regular expression. so: grep "whatever" wherever.txt Put a pipe between the grep and copy. For further reference, because grep is why a lot of people get into Linux: grep syntax (best on quotes and special characters!!!) grep regular expression syntax - Finding Files grep [really quick guide]
__________________
Hosting term analogies, revised and improved (?) |
|
#5
|
||||
|
||||
|
Oh, that wasn't a "Monday Morning" response. (Even though it *was* Monday morning.)
![]() I was genuinely curious to know what would have been a better category to put it in. Grep, eh? Will check it out. Thanks again!
__________________
In ancient Rome, the word "Actor" meant "Prostitute". Mankind seems to have forgotten this. |
|
#6
|
||||
|
||||
|
UPDATE:
Aaaaaand.... it wasn't so painful after all. Grep did the trick, once I figured out how to embed it in the cp command. Assuming the target directory is ../savefiles, it's: cp `grep . files.txt` ../savefiles Thanks for the pointer, Gwen. It's solved now.
__________________
In ancient Rome, the word "Actor" meant "Prostitute". Mankind seems to have forgotten this. |
|
#7
|
||||
|
||||
|
Quote:
And, IMO, you'd have been better (i.e., sooner) served, no matter what the category, with a heading such as "Linux syntax question"...the combination of your heading with this category was unfortunate (until I read it, I figured you were blowing off some spammer whose "exercise" had something to do with justifying whatever service or product s/he was pushing.) If you're still having trouble, post in the Linux dedi category with a link to this thread (so you don't need to either re-type, or fend off the 'have you tried grep?' questions. And to make it easier for any 'nixpert explaining why grep isn't as good as "*", whatever their suggestion for *.) Anyway, I'm sorry to have sounded cross. PS: Cross-posting at work. Glad you've gotten it working (and I thought the pipe was the only way to nest stuff).
__________________
Hosting term analogies, revised and improved (?) Last edited by gwyneth; 08-04-2009 at 12:21 AM. |
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
|
|
All times are GMT -5. The time now is 07:19 AM.











