The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM



Thread: awk error
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 05-13-2008
gyankr gyankr is offline
Registered User
 

Join Date: Jan 2008
Posts: 2
awk error

Hi all,

i have the files in the below sequence:

fancy_LANG_STD_AU_2008-03-05.dat
fancy_LANG_STD_HK_2008-03-06.dat
fancy_LANG_STD_NZ_2008-03-05.dat
fancy_STD_AU_2008-03-05.dat
fancy_STD_HK_2008-03-06.dat
fancy_STD_NZ_2008-03-05.dat

i am trying to sort them like below:

fancy_STD_AU_2008-03-05.dat
fancy_LANG_STD_AU_2008-03-05.dat
fancy_STD_HK_2008-03-06.dat
fancy_LANG_STD_HK_2008-03-06.dat
fancy_STD_NZ_2008-03-05.dat
fancy_LANG_STD_NZ_2008-03-05.dat

the script shows something like this
Code:
local flist="$@"
local filelist=`echo $flist | awk '{
while (++i<=NF) {
split($i,x,"_");
y=(x[2]=="LANG")?4:3;
print x[y],y,$i}
}' | sort -t"-" +1 +2 | awk '{print $3}'`;
I am having a small problem,when the number of files to be sorted increases,I am getting an error like below

: Input line FANCY_LANG_STD_AU_20 cannot be longer than 3,000 bytes.


I am using hp-ux and gawk does not seem to work.Any workaround.I guess there is a "fold" command but not sure if that will fulfill my needs.

Any thoughts?

Regards,
Raju

Last edited by Yogesh Sawant; 05-13-2008 at 06:08 AM. Reason: added code tags
Reply With Quote
Forum Sponsor