Microsoft
Software
Hardware
Network
Question : Bash script help
Hello,
I got 2 files as following:
1st file:
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:21:52:66:EF:FC
BROADCAST=10.10.25.255
IPADDR=10.10.25.25
NETMASK=255.255.255.0
NETWORK=10.10.25.0
ONBOOT=yes
2nd file:
DEVICE=eth0
BOOTPROTO=none
BROADCAST=10.10.26.255
HWADDR=00:31:5E:61:64:DA
IPADDR=10.10.26.126
NETMASK=255.255.255.0
NETWORK=10.10.26.0
ONBOOT=yes
I need a script that can replace the 2nd file with the contents of 1st file EXCLUDING the line which starts with BROADCAST. So the resultant file here should be as shown below:
DEVICE=eth0
BOOTPROTO=static <--------------
HWADDR=00:31:5E:61:64:DA <-------------- Please note this line is retained
BROADCAST=10.10.25.255
IPADDR=10.10.25.25
NETMASK=255.255.255.0
NETWORK=10.10.25.0
ONBOOT=yes
Thanks,
AR
Answer : Bash script help
correction
egrep 'BOOTPROTO|HWADDR' 2ndfile > myfile
grep -v HWADDR 1stfile > myfile1
cat myfile1 myfile > 2ndfile
Random Solutions
How do I add analytics (GA) to my iGoogle account?
java.lang.SecurityExceptio<wbr />n: Prohibited package name: java.util when running a Servlet with WAS 4.0.1
Flash - Pause for 10 seconds
How do I unlock files that have been locked up by a virus
Server starts generating event 1053 on random time and stops responding to login after a while. Hard power reboot only solutions.
How do I Install SSL 128bit for LWP ?
How to print to 2 printers when a document is sent to one printer in windows XP?
IIF expression in Access 2002 Query
Need Word as Outlook default editor but grayed out
Are there Excel events? (Like in VBA)