Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Trimming the first line of a file.
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.




Report this thread to moderator Post Follow-up to this message
Old Post
Rob Bradford
11-18-04 01:55 AM


Re: Trimming the first line of a file.
On 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 }'

Report this thread to moderator Post Follow-up to this message
Old Post
Chris F.A. Johnson
11-18-04 01:55 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

AWK archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:54 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.