View Single Post

   
  #6 (permalink)  
Old 02-15-2008, 04:52 PM
Ian Wilson
 
Posts: n/a
Default Re: output only 70 character

pablo hernandez wrote:
> Bob Stockler <bob@trebor.iglou.com> wrote in message news:<20050404151525.GD6745@trebor.iglou.com>...
>
>>On Mon, Apr 04, 2005 at 07:20:46AM -0700, pablo hernandez wrote:
>>|
>>| I want to "cat" one file , but shortening each line to maximum 70 characters .
>>|
>>| I think this can be done with awk , but probably there is a easy way :
>>
>> awk '{print substr($0,1,70)}' infile >outfile
>>
>>Bob

>
>
> Thanks Bob ,
>
> so awk is the only way .
>


If you have some aversion to awk, you could use cut. "cut -c 1-70
filename > otherfile"

Or Perl, Python, C or any of a few dozen other tools.
Reply With Quote