Code Comments
Programming Forum and web based access to our favorite programming groups.All. I have used AWK a little and know it can do this but I can't work out how, so I'm hopimg someone here can point me in the right direction. I have a file beinf FTP'd from a MPE/XL (HP3000) system, yes we still have one, but the MPE variant of FTP pads all lines to the same length! (it's in the manual that it will do this in ASCII mode). Using Binary or Bytestream modes yeild worse results for our purpose. My problem is this the file I have has a header line of 46 characters followed by n lines of 1468 characters, when I get the file delivered onto a HP-UX system all teh lines are1468 characters then a line-feed. Can AWK process the first line back to 46 chatracters and not touch the body of the file? Any help or pointers would be appreciated.
Post Follow-up to this messageOn Wed, 17 Nov 2004 at 21:36 GMT, Rob Bradford wrote:
> All.
>
> I have used AWK a little and know it can do this but I can't work out
> how, so I'm hopimg someone here can point me in the right direction.
>
> I have a file beinf FTP'd from a MPE/XL (HP3000) system, yes we still
> have one, but the MPE variant of FTP pads all lines to the same
> length! (it's in the manual that it will do this in ASCII mode).
> Using Binary or Bytestream modes yeild worse results for our purpose.
>
> My problem is this the file I have has a header line of 46 characters
> followed by n lines of 1468 characters, when I get the file delivered
> onto a HP-UX system all teh lines are1468 characters then a line-feed.
>
> Can AWK process the first line back to 46 chatracters and not touch
> the body of the file?
awk 'NR == 1 { $0 = substr($0,1,46) }
{ print }'
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.