LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   mv command issue (https://www.linuxquestions.org/questions/linux-newbie-8/mv-command-issue-441357/)

Freestone 05-03-2006 04:40 PM

mv command issue
 
Here we go again!

I'm working my way through a tutorial so I can learn Linux a lot better. I feel like I'm getting somewhere and then I get to something that seems should be easy, and then it stumps me. I don't want to post in here unnecessarily and I read man and info pages, but to be honest, there are times that man pages seem a bit cryptic to me and I've found that even though they provide a lot of useful information, they don't always have the answer. So, here goes....

This tutorial says to make a new directory in my home directory. No problem there. mkdir -p /home/bob/etc2
Theres a reason I named it etc2.

Then it says to copy ALL the files from /etc into the directory I created. No problem there cp -aR /etc/* /home/bob/etc2
Then....

Change into etc2 and make a directory for files starting with an upper case character and one for files starting with a lower case character. Move all the files to the appropriate directories. Use as few commands as possible.

Making the two directories isn't the problem.

How do you move files that are designated by an uppercase and lowercase letter?
I have no clue on this one.

Thanks to all!
Freestone

Learning Linux....Eating an elephant one bite at a time!

gilead 05-03-2006 04:51 PM

You can use character classes to build a pattern. For example, if you are in etc2 and you have directories called 1-upper and 2-lower (I prefixed them with numbers so the following doesn't pick them up by mistake):
Code:

mv [[:upper:]]* 1-upper
mv [[:lower:]]* 2-lower

Have a look in the man page for bash and search on character class.

Hope this helps.

Freestone 05-03-2006 05:03 PM

Gilead,

I read your reply and scratched my head. I thought you've gotta be kidding me....that won't work as I laughed to myself.

It worked.

The tutorial is for beginners. An intro to Linux. How is a beginner going to know about character classes in Bash? Geez.

Thank you for your help!

LQ, please don't mind if I ask 8 million and one more questions.

gilead 05-03-2006 05:24 PM

How is a beginner going to know about something? Exactly the way you did - by trying it, reading man pages, asking for help... ;)

Ask away, there are plenty of people here willing to help - I still learn more from the posts than I contribute.

muha 05-04-2006 03:43 AM

@Freestone: what tutorial are you following? Just curious ..

pixellany 05-04-2006 08:15 AM

Quote:

Originally Posted by Freestone
The tutorial is for beginners. An intro to Linux. How is a beginner going to know about character classes in Bash? Geez.

LQ, please don't mind if I ask 8 million and one more questions.

You are already miles ahead of the average newbie. You asked a clear question and you followed up. Further, you elicited a response that allowed others to learn something (character classes).
Keep posting and you will be giving answers in no time.....;)

Freestone 05-04-2006 10:23 AM

Muha,

The tutorial is:
Introduction to Linux
A Hands on Guide
Machtelt Garrels

I found it at the following url: http://tille.xalasys.com/training/tldp/

You can download the whole tutorial from here: http://www.tldp.org/guides.html

There are some other tutorials at tldp that may be worth looking into.
I downloaded the Bash Guide for Beginners also but I thought I'd better back up and do some fundamental things first, so, I humbled myself ~grin~ and started in on the Intro to Linux.
To be honest, I don't even know why I'm trying so darned hard to become proficient in Linux. I don't need it for work, I guess its just a hobby...kind of Man conquering machine. Just for fun I guess. Even though I haven't established a solid reason for learning this fascinating OS,
I'm in too deep now to stop. I can relate to some of the people in here that say, "I'm giving up and going back to that 'other OS', because there have been times that I felt the same way. But, with healthy pride I can say that I have one computer, a laptop, that has ONE OS on it, and that is FC5. No cross breezes here. ( No windows!) And thats the only computer that I own. So, to any of you out there that happen to read this post and are struggling with learning Linux, just keep at it and learn one thing a day if you can, even if its just a simple command from terminal (or your preffered CLI ). You don't have to learn it all in one week! ( Read my signature!!!) Thanks to all who have helped and I'll continue to help if I can.

Linux is so darned frustrating that its.....fun!

muha 05-04-2006 10:55 AM

Quote:

Originally Posted by Freestone
You can download the whole tutorial from here: http://www.tldp.org/guides.html

Thanks, i like to post these at http://bookmarks.linuxquestions.org so others can enjoy as well. Thanks :D
(this one was already linked but hey! you never know ..)

Digital Surgeon 05-04-2006 09:04 PM

check out the help file in linux some distros do not support mv as move some move is move type
mv --help

chrism01 05-05-2006 01:35 AM

I think you lost me there Digital Surgeon... ;-)
Freestone, you want to check this out, very popular: http://rute.2038bug.com/index.html.gz

Freestone 05-05-2006 10:25 AM

Digital Surgeon,

I don't think you read my post clearly. I read the man pages and info pages concerning 'mv' -----they don't provide an answer
to my question.
People get PO'd when you ask a question in here and the answer is clearly in a man or info page. I get PO'd when someone
replies without clearly reading the original post.

Read my post again and, for that matter, read the whole thread!!!--- then come up with a better answer. It clearly states that I read the man and info pages on that command.
Do the man or info pages on 'mv' contain information about moving files according to class, ie., upper case and lower case? No, they don't.
Please, before you reply with a flippant, know-it-all response, consider what the person is asking.

Anybody can say, "Read the man page!" They don't always spell it out for people.

Cheers.

Freestone 05-05-2006 10:59 AM

Chrism01,

Geez, I just took a look at the link you directed me to and WOW. That looks like what I've been looking for!
Talk about depth.

Maybe I can learn it all in a week! ~grin~

Thanks!!

Digital Surgeon 05-07-2006 10:30 AM

Was just trying to help you by giving you info that I know thought youd appreciate it, jeeze wheres the spirit of linux in u.

Quote:

Originally Posted by Freestone
Digital Surgeon,

I don't think you read my post clearly. I read the man pages and info pages concerning 'mv' -----they don't provide an answer
to my question.
People get PO'd when you ask a question in here and the answer is clearly in a man or info page. I get PO'd when someone
replies without clearly reading the original post.

Read my post again and, for that matter, read the whole thread!!!--- then come up with a better answer. It clearly states that I read the man and info pages on that command.
Do the man or info pages on 'mv' contain information about moving files according to class, ie., upper case and lower case? No, they don't.
Please, before you reply with a flippant, know-it-all response, consider what the person is asking.

Anybody can say, "Read the man page!" They don't always spell it out for people.

Cheers.


ioerror 05-07-2006 03:47 PM

Quote:

Originally Posted by Freestone
Do the man or info pages on 'mv' contain information about moving files according to class, ie., upper case and lower

Of course not, character classes have nothing to do with mv, they are a feature of the shell (well, obviously lots of commands support regex but unquoted patterns on the command line are interpreted by the shell).

Quote:

Originally Posted by Freestone
Read my post again and, for that matter, read the whole thread!!!--- then come up with a better answer. It clearly states that I read the man and info pages on that command.

Dude, like, chill! This is a voluntary, public forum. It's a little unreasonable to expect a certain "quality" of answer. If that's what you want, you're gonna have to pay for it. There are plenty of consultants who will take your money.

Quote:

Originally Posted by Digital Surgeon
check out the help file in linux some distros do not support mv as move some move is move type

D.S., I can't make head or tail of that. :confused:


All times are GMT -5. The time now is 01:25 AM.