Solved

ksh or bash

Posted on 2011-09-19
1
358 Views
Last Modified: 2012-05-12
I want to create a script to add new rules into iptables file on maybe 100 servers. What would be the best way in ksh or bash to do this. If I grep on a certain parameter and then when I find that not sure how to echo"new line 1...."' echo "new line 2" after the matching parameter.
0
Comment
Question by:lolaferrari
1 Comment
 
LVL 18

Accepted Solution

by:
liddler earned 500 total points
ID: 36558985
I think you need to use sed

for example if you need to text "new line 1" after "parameter1"
you would do:
sed '/parameter1/a new line1' iptable_file >iptable_file.new
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now