Results 21 to 30 of 34
look at the syntax in the man page:
Code:
cat [FILE]
where you replace [FILE] with the file you read... (btw you don't need the -n with the cat).
in ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 11-15-2005 #21
look at the syntax in the man page:
where you replace [FILE] with the file you read... (btw you don't need the -n with the cat).Code:cat [FILE]
in the end the cat [FILE] will be on the same line as | wc -l
dylunio
- 11-15-2005 #22Just Joined!
- Join Date
- Oct 2005
- Posts
- 23
#!/bin/sh
ls > Files
cat Files| wc -l
!
- 11-15-2005 #23
WOOOHOOO!!!!
you got it:
There may not be other times when I'm bored, so get yourself some kind of system where you can test if these scripts work at all.Code:#!/bin/sh ls > Files cat Files | wc -l
- 11-15-2005 #24Just Joined!
- Join Date
- Oct 2005
- Posts
- 23
Eurika!
At long last, ey.
Great, thanks enormously.
- 11-16-2005 #25Just Joined!
- Join Date
- Oct 2005
- Posts
- 23
Hm... Pardon me, but I've arrived at a SECOND blip..
I think it's quite a simple problem though.
I'm trying to move all .txt files from my current directory to one called TxtFiles.
I think that to do this I can use:
#!/bin/sh
*.txt > TxtFiles
Does that seem right? I don't have access to Linux so I'm unable to test it.
Now though, what I want to do is produce a text file that then displays the list of .txt documents that were moved. This text file could be called something like "txtFilesMoved".
Any clues on how I would go about this? I aren't too sure where to even start when it comes to listing moved files. I feel the possible need for a pipe..
thanks.
- 11-16-2005 #26
This is more complicated...if you want to move all the .txt files from one place to another but with changed names, then list them you'll have to look into such things as for loops (google them, as well as look at www.linuxcommand.org), and variables.
Also look into the cp or mv for changing the location of the files.
- 11-16-2005 #27Just Joined!
- Join Date
- Oct 2005
- Posts
- 23
Oh okay thanks, I don't need to change the individual .txt file names though. I just want to move them to a different directory named TxtFiles.
Using the mv command, would this work then for moving the .txt files from the current directory all to a TxtFiles current directory? :
#!/bin/sh
mv *.txt --target-directory=TxtFiles
- 11-16-2005 #28You don't need teh --target-directory= stuff just have it
Originally Posted by Scarfinger Code:mv *.txt TxtFiles
- 11-16-2005 #29Just Joined!
- Join Date
- Oct 2005
- Posts
- 23
Okay great, got it.
So now after managing to move all these files, I need a .txt file that displays the full list of text files that were moved.
I think I'll need the ls command for that.
Do you think something as simple as this would work? :
ls > TxtFilesMoved
Would that produce a text file containing all of the text files I've moved from the current directory into TxtFiles?
- 11-16-2005 #30
It would work if you used ls in conjunction with the naming of the directory if was to list.
You realy REALY need to ether get Linux installed or install Cygwin...otherwise your going to have a hell of a time.


Reply With Quote
