LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Question about "ls -f -l" command output in RHEL 5.2 and Red Hat 6 (https://www.linuxquestions.org/questions/linux-newbie-8/question-about-ls-f-l-command-output-in-rhel-5-2-and-red-hat-6-a-731981/)

eaerhard 06-10-2009 12:36 PM

Question about "ls -f -l" command output in RHEL 5.2 and Red Hat 6
 
Hey all, I am just here hoping someone can help me out with a problem.

I am having an issue that I need to get resolved. The background to the scenario is, a project at work is currently using a system running Red Hat 6. It is being accessed by another system (an HP system) to pull files for testing hardware. Basically, when it pulls the files, they are being pulled the same as what the "ls -f -l" command would return, so list format with the files listed alphabetically. So, an ls -f -l command outputs the files as A, B, C, D, etc.... in that order

The project has implemented a new Linux box to replace the Red Hat 6 system and it is now running RHEL 5.2. When the HP system accesses this new Linux box to pull the same files, the output is returned with the files out of order, no longer in alphabetical order. The ls -f -l command on this new system returns the same set of files as B, D, A, C.... consistently in that order.

The code that the HP box uses to access the files depends on the output to be in the A, B, C, D.... order (yeah, poor coding but it is an OLD system).

Is there a way to change the output order that the ls -f -l command displays in RHEL 5.2 so that it will return the alphabetical order rather than whatever order it is currently outputting?

I apologize if this is a bit confusing, I am not a Linux admin by any means but it has been handed to me to resolve. Any help would be greatly appreciated. Thanks in advance.

salasi 06-10-2009 04:49 PM

from the man page:

Quote:

-f do not sort, enable -aU, disable -ls --color
so you can rid of this peculiar output by not specifying -f. that may not be what you want, but it will be different.

If you really want to gain control, you may have to pipe the output through something else (sort, awk?) to sort it into the order that you want, if you can define that.

eaerhard 06-11-2009 06:48 AM

salasi, yeah, that is what we were thinking but the code that accesses the data depends on the order of the output looking like the order supplied by the -f command. It was coded poorly and the group using the code (who also wrote the code) said it is a ridiculous amount of code to change and are looking for a way to change the output through the OS. Unfortunately, from our IT department's standpoint, the code is not going to change unless it is the last resort. The output we need it to pull is what the standard ls -l output gives us (sorted) but unfortunately the code pulls it with the -f option (unsorted), which is now different in RHEL 5.2.


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