How to sort find results
Jeffrey Ellis
jellis at dhnet.us
Tue Nov 8 17:47:05 GMT 2005
Hi, David--
That did it! Thank you :)
So, now when I run it I get the following output:
# ./date_sort /desktop
Sep 13 11:10:34 2005 /desktop/.localized
Nov 8 09:12:40 2005 /desktop/date_sort
But there are actually 76 items on my desktop. Is it possible I'm not
specifying an option correctly?
Thanks again :)
All My Best,
Jeffrey
on 11/8/05 5:31 AM, David Fleck at david.fleck at mchsi.com wrote:
> On Mon, 7 Nov 2005, Jeffrey Ellis wrote:
>> It's on my Desktop. Should it be in particular location? (Don't say it...
>> Something obvious, right ;)
>
> It doesn't have to be anywhere in particular, as long as you can find it
> when you want to run it. When you typed
>
>>> #head date_sort
>>> head: date_sort: No such file or directory
>
> I assume that the date_sort script wasn't in the directory you were
> running the 'head' command from. In this case, you'd have to run it as
>
> #head /full/path/to/date_sort
>
> otherwise 'head' won't be able to find date_sort.
>
>> I actually did see his email. I've checked the copy/paste of the script, and
>> it looks like all carriage returns. I don't know how to type line feeds...
>> Is that what they should be?
>
> The problem is that Windows and UNIX have different concepts of how to end
> lines. Windows (and some mail programs, and possibly some web servers -
> I'm just guessing here) think each line of a text-mode should end with a
> carriage return (CR) followed by a line feed (LF). UNIX doesn't
> distinguish between text-mode and binary-mode files, and thinks a line
> should end with just an LF, and the CR is retained as extra junk at the
> end of the line.
>
> The easiest way that I know of to check for and handle this problem (which
> may not be the easiest way to handle it, but it's the one I'm familiar
> with) is to use the 'vi' editor. I don't know if you're familiar with
> 'vi'; it can be a little confusing to the uninitiated. The following
> should step you through it -- make a backup of the date_sort file first.
>
> 1. cd to the directory containing date_sort.
>
> 2. Open the file in vi:
> #vi date_sort
>
> 3. Type the following, where [Ctrl] means the Ctrl key, and [Enter] means
> the Enter key:
>
> :%s/[Ctrl]V[Enter]//[Enter]
>
> 4. Save the result:
> :wq[Enter]
>
> Now, hopefully, the CR-LF's have all been converted to LF's. Try running
> the script again (personally, I'd test it on a smaller directory structure
> than /, just to see if it works -- running it on / will probably take a
> long while).
>
> The output of 'head /path/to/date_sort' may still be useful, btw.
>
> --
> David Fleck
> david.fleck at mchsi.com
>
More information about the freebsd-questions
mailing list