AWK experts - how would I code around this in awk...

Alex Janssen alex at ourwoods.org
Fri Feb 19 04:16:16 UTC 2010


Christopher Chan wrote:
> On Friday, February 19, 2010 02:02 AM, Steve Flynn wrote:
>   
>> I have a text file with lines of differing length.
>>
>> I want  to parse the entire file and make each line (for example) 20 bytes long.
>>
>> If a record is too short as in the following example: (rec1,2 and 3
>> are just so I can refer to them easily - the example file should be
>> just the numeric portion).
>>
>> rec1 123456789012345
>> rec2 67890
>> rec3 12345678901234567890
>>
>> ... then I need to append rec2 to rec1.
>>     
>
> You just have to make each line 20 bytes long right. There is no need to 
> preserve lines that are already 20 bytes long like in the case that rec1 
> + rec2 will not make up 20 bytes and so we chop up rec3 and so on and so 
> forth right?
>
>   
I think he wants to get rid of all the CRLF's and reformat it into lines 
of 20 bytes.

Alex

-- 
Ourwoods.org
 Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. - Albert Einstein (275)





More information about the ubuntu-users mailing list