LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Need some help (https://www.linuxquestions.org/questions/linux-newbie-8/need-some-help-815027/)

Dru-Jitsu 06-18-2010 08:24 PM

Need some help
 
So I am taking an half online/ half go to school class. I am working on an assignment that is due tonight by midnight. I am kind of confused on this question and am waiting on an email from my instructor but only have 2.5 hrs left til it's done. Here is the question.

Use file globbing to copy all the files in the /labs/data directory that end with a .out to the lab07 directory. How many files are in the lab07 directory?

Ok so.... I put myself into the /labs/data dir

cd /labs/data

ls -l

when I ls -l into this directory. I don't see any files with that extension. Is there an easier way that I am missing such as. cp /labs/data *.out > lab07 ??? Someone help?

blue_print 06-18-2010 08:40 PM

I don't think the command you tried have worked.

Before copying files, you will have to make sure that the files with the extensions .out are there or not in '/lab/data' directory. Then, have the following command to copy the files,

cp /labs/data/*.out /lab07/

Dru-Jitsu 06-18-2010 08:59 PM

I tried using the advice given. Now it tells me that the directory doesn't exist. Starting up the first thing I did was mkdir /lab07. I am really not to sure where to go from here.

dxqcanada 06-18-2010 09:04 PM

Ok ... so you are in the /labs/data directory ... and you run ls -l ... and you see no files that are blahblah.out ?

Hmmm .. try ls -a

Dru-Jitsu 06-18-2010 09:13 PM

Yes I tried both of those... I enter the directory cd /labs/data and then I ls -l or -a and I see nothing in there that ends with .out.

As for copying it over into my directory... what about this?

cp /labs/data/ned /labs/data/fred ~/labXX # now combine it together using file globing:

cp /labs/data/[nf]ed ~/labXX

Dru-Jitsu 06-19-2010 06:54 PM

I figured out the one from last night, now I am onto a new headache....


Use file globbing to copy all the files in the /labs/data directory that start with a c, d, or n into the lab07 directory. How many files are now located in the lab07 directory?

this is the command I am using
I am in my created directory lab07

cp /labs/data[c,d,n]~/lab07

I am getting a specified destination directory does not exist, I know it exists I am in it right now. Any help would be awesome.

chrism01 06-20-2010 10:49 PM

As this is homework, I'll just make a few suggestions (as per LQ rules)

1. you need a '/' between the dirname & filenames
2. you need space between src and target
3. Bookmark and read:
http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/


All times are GMT -5. The time now is 04:03 AM.