The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
concatenate files sorted by date docaia Shell Programming and Scripting 2 08-16-2008 03:23 AM
Compare 2 sorted files varungupta Shell Programming and Scripting 7 01-25-2008 01:07 PM
Order files by create date mab_arif16 Shell Programming and Scripting 4 05-15-2006 02:04 PM
list of files in date order Jeannine UNIX for Dummies Questions & Answers 2 08-15-2005 03:19 PM
lp - order of files printed mabrownawa UNIX for Advanced & Expert Users 2 02-16-2004 12:08 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 05-19-2008
epi8 epi8 is offline
Registered User
  
 

Join Date: May 2008
Posts: 7
Arrow executing code on files in the sorted order -help!

Say i have 2 files in the giving format:
file1
1 2 3 4
1 2 3 4
1 2 3 4

file2
1 2 3 4
1 2 3 4
1 2 3 4

I have a PERL code (loaned by one of u -i forgot who - thanks!) that extracts the 2nd column from each file and append horizontally to a new file:

perl -ane 'push @{$L->[$.]}, $F[1]; close ARGV if eof;
END { shift @{$L}; for $l (@{$L}) { print join (" ", @{$l}), "\n"; }}' * >> out.txt

Which does the job for over 900 files --but I think it's doing it randomly. The files have an alphanumerical name that follows a chronoloigcal order --and that's the order I would like them to be appended in.

How edit the script so that the job is executed as such.

desire final result: (disregard the spacing)
file1 file2
2 2
2 2
2 2


thanks in advance --!!!!
 

Bookmarks

Tags
perl, perl shift, shift, shift perl

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:09 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0