![]() |
|
|
|||||||
| Home | Forums | Register | Rules & FAQ | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
Other UNIX.COM Threads You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Find lines with space between strings | Galt | Shell Programming and Scripting | 5 | 05-07-2008 11:06 AM |
| Adding words to beginning of lines | Ernst | Shell Programming and Scripting | 9 | 04-03-2008 11:23 AM |
| grep - to exclude lines beginning with pattern | frustrated1 | Shell Programming and Scripting | 2 | 08-29-2005 04:18 AM |
| delete lines from file2 beginning w/file1 | michieka | Shell Programming and Scripting | 13 | 06-24-2003 10:42 AM |
| re: removing trailing space from lines | oombera | Shell Programming and Scripting | 1 | 06-19-2003 07:12 AM |
![]() |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
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 ! . . . . |
| Forum Sponsor | ||
|
|
|
|||
|
Code:
awk '{ printf("!\ninterface %s\n%s\n%s\n", $0, " no shut", " switchport mode access")}' file1.txt
Quote:
Last edited by jim mcnamara : 05-01-2008 at 09:03 AM. |