Sponsored Content
Top Forums Shell Programming and Scripting sort file text by date as a "ls -t" Post 302358715 by protocomm on Sunday 4th of October 2009 09:57:48 AM
Old 10-04-2009
I list files on server ftp and, it gives me a list of file in alphabetic order.
I want this list of file in order like "ls -t", the niewer in first and the older last.

INPUT:

Code:
drwxr-x---  2 ftp_mont System            0 Sep 30 09:16 .
drwxr-x---  2 ftp_mont System            0 Jul 15  2009 ..
-rwxr-x---  1 ftp_mont System    250324761 Sep 27 15:47 Dossier_secheresse-H264-1.mov
-rwxr-x---  1 ftp_mont System    343998791 Sep 30 09:20 manif laitiers-H264.mov
-rwxr-x---  1 ftp_mont System    169097455 Sep 27 15:55 Mende_Mende-H264.mov
-rwxr-x---  1 ftp_mont System     12063097 Sep 27 15:32 Mende_Mende_ITW.mov

OUTPUT:

Code:
-rwxr-x---  1 ftp_mont System    343998791 Sep 30 09:20 manif laitiers-H264.mov
-rwxr-x---  1 ftp_mont System    169097455 Sep 27 15:55 Mende_Mende-H264.mov
-rwxr-x---  1 ftp_mont System    250324761 Sep 27 15:47 Dossier_secheresse-H264-1.mov
-rwxr-x---  1 ftp_mont System     12063097 Sep 27 15:32 Mende_Mende_ITW.mov

I want to do this because i get file by mirroring with wget and wget have a problem with the files with accent...
I thank to rename the file downloaded by wget with the list of file on server then i have 1 file text where have the file in order "by time"

Code:
let i=0;for file in /Users/macbook/oberon/*;do echo "$file";let i=i+1;var="$(cat $temp/oberon_trie.txt | sed 's/ *$//g' | sed -n "$i"p)";mv "$file" "/Users/macbook/oberon/$var";done


Last edited by protocomm; 10-04-2009 at 11:03 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

add seconds to: date"|"time"|"HHMMSS

Hey all, I have a shell that invokes a AWK. In this AWK i want invoke a function that receives 3 parameters: date: 20080831 time: 235901 duration: 00023 that function receive this 3 parameters and sum to this value two more seconds: 2008083123590100025 Remember that in case that... (3 Replies)
Discussion started by: anaconga
3 Replies

2. Solaris

"mail" command sort by date

Hello experts, I am using SunFire T200. When I start reading the mail with "mail" command it comes older mail first. From MAILER-DAEMON Sat Mar 28 06:02:48 2009 Return-Path: <MAILER-DAEMON@emarn1> Received: from localhost (localhost) .... .... I want to see the most recent mail... (1 Reply)
Discussion started by: thepurple
1 Replies

3. AIX

xx=`date +"%a %b %d"`;rsh xxx grep "^$XX" zzz ?

AIX 4.2 I am trying to do an rsh grep to search for date records inside server logs by doing this : xx=`date +"%a %b %d"` rsh xxx grep "^$XX" zzz gives : grep: 0652-033 Cannot open Jun. grep: 0652-033 Cannot open 11. But if I do : xx=`date +"%a %b %d"` grep "^$XX" zzz it works... (2 Replies)
Discussion started by: Browser_ice
2 Replies

4. Shell Programming and Scripting

Meaning of "b" modifier in "sort" command

I need to sort the following file by the rhdiskpower devices in the last column: Total_MB Free_MB OS_MB Name Failgroup Library Label UDID Product Redund Path 1024 851 1024 OCRVOT1_0000 OCRVOT1_0000 System UNKNOWN ... (3 Replies)
Discussion started by: wjssj
3 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Shell Programming and Scripting

sort text having delimiter with "|" (pipe)

i am having text file below NARGU S S 12358 SALES REP |22| Acccount/s RAJU R B 64253 SALES REP |12| Acccount/s RUKMAN S 32588 SALES REP |10| Acccount/s NARGUND S S 12356... (3 Replies)
Discussion started by: suryanarayana
3 Replies

7. Shell Programming and Scripting

Using sed to find text between a "string " and character ","

Hello everyone Sorry I have to add another sed question. I am searching a log file and need only the first 2 occurances of text which comes after (note the space) "string " and before a ",". I have tried sed -n 's/.*string \(*\),.*/\1/p' filewith some, but limited success. This gives out all... (10 Replies)
Discussion started by: haggismn
10 Replies

8. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

9. UNIX for Beginners Questions & Answers

Extract delta records using with "comm" and "sort" commands combination

Hi All, I have 2 pipe delimited files viz., file_old and file_new. I'm trying to compare these 2 files, and extract all the different rows between them into a new_file. comm -3 < sort file_old < sort file_new > new_file I am getting the below error: -ksh: sort: cannot open But if I do... (7 Replies)
Discussion started by: njny
7 Replies

10. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
qc2movie(1)						    BSD General Commands Manual 					       qc2movie(1)

NAME
qc2movie -- Quartz Composer export tool SYNOPSIS
qc2movie inCompositionPath|repositoryCompositionIdentifier outMoviePath width height duration [--parameterKey1 value1 ...] DESCRIPTION
qc2movie is a tool that exports a Quartz Composer composition into a QuickTime movie by adding a track containing this composition. It is the command line equivalent of exporting a composition for the Quartz Composer application to a QuickTime movie. OPTIONS
inCompositionPath|repositoryCompositionIdentifier specifies which composition you want to export. Ar inCompositionPath is the path to the composition. Ar reposito- ryCompositionIdentifier is the identifier of a composition which lies in the Quartz Composer Repository. outMoviePath specifies movie file path to which the composition will be exported to width defines the width of the export movie height defines the height of the export movie duration defines the length of the export movie [--parameterKey1 value1 ...] passes composition specific parameters through the command line tool to the composition EXAMPLES
-To create a 10 second QuickTime movie containing a Quartz Composer track of the Particle System composition: qc2movie "/Developer/Examples/Quartz Composer Compositions/Particle Systems/Particle System.qtz" ~/example.mov 640 480 10 -To merge two video tracks (30s each) together using an image transition protocol abiding composition (Swing for example) in the Quartz Composer Repository (using its identifier: /swing): qc2movie /swing ~/merged-example.mov 640 480 60 --inputMoviePath1 ~/firstVideo.mov --inputMoviePath2 ~/secondVideo.mov --duration 2 -To apply an image filter protocol abiding composition to the video track of a movie: qc2movie /colorpencil ~/effect-example.mov 640 480 30 --input ~/Video.mov SEE ALSO
pcastaction(1) Mac OS July 9 2007 Mac OS
All times are GMT -4. The time now is 09:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy