Hi guys,
Probably an easy one, but how do you sort a directory so that the files come first, then subdirectories?
ie ./dir1 contains
file 1
subdir 1
file 2
i need it to become
file 1
file 2
subdir 1
as i'm using it in a script to pass each one through a for loop, and would... (2 Replies)
Hi guys,
Probably an easy one, but how do you sort a directory so that the files come first, then subdirectories?
ie ./dir1 has
file 1
subdir 1
file 2
i need it to become
file 1
file 2
subdir 1
as i'm using it in a script to pass each one through a for loop, and would like all... (3 Replies)
If I do an ls -l on a directory I get this:
-rw-r--r-- 1 root other 5248094 Jun 24 03:56 monitor.log.7
-rw-r--r-- 1 root other 5248303 Jul 11 11:19 ct.log.1
-rw-r--r-- 1 root other 5248907 Jun 29 06:01 ct_monitor.log.5
-rw-r--r-- 1 root other 5249042 Jun 19... (1 Reply)
Hi Guys,
I am very new to Unix.Can anyone tell me how to sort a file based on fields.
For example, I am having a file whose contents are mentioned below:
2233|charles harris |g.m. |sales |12/12/52| 90000 9876|bill johnson |director... (3 Replies)
Hi,
I have a file which has data as
path/1.xml path/2.xml,...(each in separate lines)
I want to sort this file in order. It is not working when I give
"sort filename"
The number of "/" in path can vary.
Thanks,
Floyd (1 Reply)
I have a text file with full list of files with their full path. I wanted to sort it by directory then files then subdirectory by alphabetically. When I used the sort command it doesn't give like what I want. Could somebody help me on this.
Here is the ex:
This is what I'm getting... (2 Replies)
Hello forum members,
I am writing a script to two tasks.
1: displaying the list of the files in the current directory.
2: removing the specifed file from the list.
I have written a sample script ,so can u please verfiy and correct.
echo Enter list of files
ls *.txt
read textfile
rm -f... (3 Replies)
I have files with the name
myfile_YYMMDD.txt
I need to sort them by their date stamp. I know this will work.
ls -lrt * | awk '{print $9}' | cut -d "_" -f3 | sort
However, it just returns YYMMDD.txt
I can then append the myfile_ to it. However, that myfile_ may change. How do... (1 Reply)
1. The problem statement, all variables and given/known data:
I'm trying to use a directory path to enter a new directory and sort the files there. I'm using the language C with a system call in Unix to sort the files from smallest to largest.
2. Relevant commands, code, scripts, algorithms:... (1 Reply)
Hi All,
I am working on a huge pile of data. Its about a service initiating a call and and finishing it.
The columns that I have is:
Date Time URL Call Type ServiceName
5/11/2015 15:00:00 http-/0.0.0.0:8091-9 going to... (3 Replies)