Solved

ksh or bash

Posted on 2011-09-19
1
361 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

828 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