Re: "cut" command not working as expected

2003-06-20 Thread Will Trillich
On Wed, Jun 18, 2003 at 07:18:31PM +0100, David selby wrote: > David selby wrote: > >I need to get the first two file names from a directory ... [snip] > >directory=$(ls -r --format=single-column) > >cut -d' ' -f2 $directory [snip] > >I am a relative begginer at learning bash ... 'course, this isn

Re: "cut" command not working as expected

2003-06-18 Thread David selby
David selby wrote: I need to get the first two file names from a directory ... My code directory=$(ls -r --format=single-column) works perfect and gives me ... 20030617Jun17.tar.gz 20030616Jun16.tar.gz 20030615Jun15.tar.gz 20030614Jun14.tar.gz 20030613Jun13.tar.gz 20030612Jun12.tar.gz 20030611

Re: "cut" command not working as expected

2003-06-17 Thread Elizabeth Barham
David writes: > I want to cut the first two file names from the list ... To my way of > thinking this should be easy ... > > cut -d' ' -f2 $directory > > The xterm goes nuts and ends up in hyroglyphics ! At a guess I would say > that the white space between .gz & 200... may not be space but ma

Re: "cut" command not working as expected

2003-06-17 Thread Nathan Poznick
Thus spake David selby: > I need to get the first two file names from a directory ... > My code > > directory=$(ls -r --format=single-column) > > works perfect and gives me ... > > 20030617Jun17.tar.gz 20030616Jun16.tar.gz 20030615Jun15.tar.gz > 20030301Mar01.tar.gz 20030222Feb22.tar.gz 2003021

Re: "cut" command not working as expected

2003-06-17 Thread Craig Dickson
David selby wrote: > I need to get the first two file names from a directory ... > My code > > directory=$(ls -r --format=single-column) > > works perfect and gives me ... > > 20030617Jun17.tar.gz 20030616Jun16.tar.gz 20030615Jun15.tar.gz > 20030614Jun14.tar.gz 20030613Jun13.tar.gz 20030612Jun

Re: "cut" command not working as expected

2003-06-17 Thread Jonathan Matthews
On Tue, Jun 17, 2003 at 08:54:59PM +0100, David selby wrote: > I need to get the first two file names from a directory ... If that's the spec, then I'd do ls | head -2 and that'd give you the first two files, unless you have 'ls' aliased to something else (ls -C, perhaps ..?) > My code > > di

Re: "cut" command not working as expected

2003-06-17 Thread Jeremy Brooks
You could do: directory=$(ls -1 | tail -2) this lists each file one at a time, and then gets the last 2 lines On Tue, 2003-06-17 at 12:54, David selby wrote: > I need to get the first two file names from a directory ... > My code > > directory=$(ls -r --format=single-column) > > works perfect

"cut" command not working as expected

2003-06-17 Thread David selby
I need to get the first two file names from a directory ... My code directory=$(ls -r --format=single-column) works perfect and gives me ... 20030617Jun17.tar.gz 20030616Jun16.tar.gz 20030615Jun15.tar.gz 20030614Jun14.tar.gz 20030613Jun13.tar.gz 20030612Jun12.tar.gz 20030611Jun11.tar.gz 2003061