![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | 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. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| shell script to edit file and delete entry | tannu | Shell Programming and Scripting | 6 | 09-09-2008 03:04 PM |
| userpw.h AIX ( delete entry from the shadow password database ) | nighter | High Level Programming | 4 | 07-15-2008 02:06 PM |
| delete dhcp.conf entry using sed | tizatron | Shell Programming and Scripting | 2 | 11-26-2007 05:59 PM |
| HOSTS File | cymerman | UNIX for Dummies Questions & Answers | 4 | 01-19-2007 12:26 PM |
| how to delete entry in file "wtmpx"(/var/adm/wtmpx) | arm_naja | UNIX for Advanced & Expert Users | 4 | 03-08-2006 04:00 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
delete entry from /etc/hosts file ?
Hi there
I have a requirement where i have to globally remove a hosts file entry from all boxes e.g. Code:
10.01.10.1 my_server1 But ....two things I want to make sure i delete the line ONLY if both the ip AND the hostname are as defined (so that i know im deleting only this line) and the gap between the IP and hostname within the hosts file is variable with any potential number of spaces or tabs in between the two Does anybody have an idea on how i can achieve this ? Any help on this would be great |
|
||||
|
its ok, worked it out
Code:
perl -pi -e "s,^10.10.10.1.*my_server1\n$,," /etc/hosts |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|