search for string and add the second line below

view full story

http://www.unix.com – Hi there, i have an /etc/hosts file that is organised in sections, like this Code: # # Oracle Servers #  boxa  boxb  boxj # # Prod Sybase Servers #  boxt boxz I am just trying to write a line of code that will ill be able to pass the comment block name without the prepended hash and space (e.g. just ' Prod Sybase Servers') and it would add the new host entry at the top of the block under the last comment hash Ive managed to put together a little awk line that will take a string to search in the first column ($1 (HowTos)