The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 02-28-2006
mahendramahendr mahendramahendr is offline
Registered User
 

Join Date: Dec 2005
Location: London
Posts: 222
nawk 'BEGIN {FS="[ |/]"}
{
printf("%s|%s|%s/%s/%s %s",$1,$2,$4,$5,$3,$6);
for(i=7;i<=NF;i++)
{
printf("|%s",$i);
}
printf "\n";
}' filename

if you want to sort based on the date field, then append the following to end of above command.

| sort -t "|" -k 3.3
Reply With Quote