|
|
|
|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||
|
Just modify the print clause in the awk command to, Code:
awk -F" = " '/Host/ { arr[i++] = substr($2, 0, length($2) - 1) }END{ for ( i in arr ) { printf "Host[%d]=%s\n", i, arr[i] } }' filename |
| Sponsored Links |
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Insert line break in vi's command mode | Skogsmulle | UNIX for Dummies Questions & Answers | 3 | 07-06-2007 11:47 AM |
| Replacing characters in file with line break | johnemb | Shell Programming and Scripting | 10 | 04-26-2007 08:38 AM |
| Sed Help (Using expression - line break) | Janus | Shell Programming and Scripting | 2 | 02-16-2007 08:50 PM |
| Remove Line Break | Rock | Shell Programming and Scripting | 5 | 02-06-2007 09:54 AM |
| Trim whitespace and add line break | moose1 | Shell Programming and Scripting | 7 | 01-22-2007 01:53 PM |