Afficher un message
Vieux 01/11/2006, 21h25   #4
Daniel Rock
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: sed replace first five chars

NoManKey <nomadic.monkey@gmail.com> wrote:
> Hi - I have a file that contains a series of fields that I need to
> retain but into which I need to insert a new field.
>
> The new field has to be the first field and consist of 8 characters
> broken down as a five digit number (preferably starting as 00001)
> followed by 3 spaces. The number being inserted into the first field
> needs to be incremented on each subsequent line.
>
> Is this a simple one or trickier than it sounds???


awk '{ printf("%05d %s\n", NR, $0) }' /your/file

--
Daniel
  Réponse avec citation
 
Page generated in 0,05306 seconds with 9 queries