Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google site



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Closed Thread
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Rate Thread Display Modes
  #8 (permalink)  
Old 08-28-2007
Technorati Master
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 3,007
Quote:
Originally Posted by aajan View Post
Yes Am looking for the Format which i have given in the o/p

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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 02:53 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2010. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0