Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SCRIPT] Sort Files..
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Phenax
l33t
l33t


Joined: 10 Mar 2006
Posts: 972

PostPosted: Sun Jan 28, 2007 1:03 am    Post subject: [SCRIPT] Sort Files.. Reply with quote

Well, there's a lot of files I like in alphabetical order, but I usually don't have the time to list them that way. I wrote a quick BASH script to do this for me. You can use wildcards and all of that jazz.

Code:

#!/bin/bash

files=( /etc/paludis/*.conf /var/db/pkg/world )

for file in ${files[@]}; do
        sort -o $file $file
done


Just change the files array, and you're set. Mines on a nice cron job.


Last edited by Phenax on Sun Jan 28, 2007 4:50 am; edited 1 time in total
Back to top
View user's profile Send private message
Conan
Guru
Guru


Joined: 02 Nov 2004
Posts: 360

PostPosted: Sun Jan 28, 2007 4:32 am    Post subject: Reply with quote

sort -o $file $file

no need for tmp file, sort doesn't mess it up.
Back to top
View user's profile Send private message
Phenax
l33t
l33t


Joined: 10 Mar 2006
Posts: 972

PostPosted: Sun Jan 28, 2007 4:50 am    Post subject: Reply with quote

Conan wrote:
sort -o $file $file

no need for tmp file, sort doesn't mess it up.


Oops, didn't catch that!
Thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum