The UNIX and Linux Forums  


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




Thread: NAWK question
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 01-28-2008
shamrock shamrock is offline Forum Advisor  
Registered User
  
 

Join Date: Oct 2007
Location: USA
Posts: 753
Quote:
Originally Posted by DeltaX View Post
I think I figured it out !!

Thanks anwyays.


I have another question

I'm trying to do a fold script similar to the one built in the system. For ex, let say I wanna fold lines at 80 columns ( given input with lines that are 120 columns long, it prints the first 80 characters of each line, a new line, and then the remaining 40 characters )

Thanks in advance

Code:
awk '{s1=substr($0,1,80);s2=substr($0,81);print s1;print s2}' file