Add new lines with a space in beginning

Hi

file1.txt contains

GigabitEthernet1/1
GigabitEthernet1/2
GigabitEthernet2/2
GigabitEthernet2/4
GigabitEthernet2/14
GigabitEthernet2/16

can anyone show me how to modify it as below. there is a space at the beginning of the next two lines . ie 'no shut' and 'switch..'

!
interface GigabitEthernet1/1
no shut
switchport mode access
!
GigabitEthernet1/2
no shut
switchport mode access
!

.
.
.
.

awk '{ printf("!\ninterface %s\n%s\n%s\n", $0, " no shut", " switchport mode access")}' file1.txt
awk '{printf("!\n%s\nno shut\nswitchport mode access\n", $0)}' file1.txt

Hi Jim,

THanks for your response. I get the o/p but I want a space before no and switchport
Regards,
aejaz

Folks,
Two things I am missing....

  1. interface in the first line
  2. space in the beginning of the first two lines.

Regards,

Note the change "no -> " no

Next time try using either quote ot code tags around expected output. Thanks.

Folks,
I am getting a space now, tried applying space
awk '{ printf("!\ninterface %s\n%s\n%s\n", $0, " shut", " switchport mode access")}' file1.txt
but i am not getting interface at the beginning for the first line.

Aejaz,
pls use the vB Codes when posting either code samples and/or quoting input/output.
Not doing so makes it very difficult for anyone here to help you.
Thanks.

Thanks to All.