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 the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #7 (permalink)  
Old 08-15-2007
lorcan lorcan is offline
Registered User
  
 

Join Date: May 2007
Posts: 219
To print the Header and trailer in one line with 300 char each. Removal of header and trailer line. Use the below

Just a flavour to matrixmadhan's command as per your req


Code:
awk ' { if ( NR == 1 ) { head=substr($0,1,300);} else { last = substr($0,1,300);} arr[i++]=$0; }END{ printf "Header is : %-300s Trailer is : %-300s\n", head, last; for( x=1; x<i-1; x++) { print arr[x] } }' filename