hot to al line before last 2 lines
I need to add a line in a file before the last two lines using a script using standard linux editors like sed but i can't figure it out.
Any suggestions? Thank you! |
Hi,
Welcome to LQ! So you've shown us your need! What's your deed? We will aid you when you help yourself to a solution. Provide us with what you have attempted and then maybe someone will be able to assist. 'How to Ask Questions the Smart Way' would be one link you should look at to help us to help you in the future. Smells like homework? Just a few more links to aid you; Linux Documentation Project Rute Tutorial & Exposition Linux Command Guide Utimate Linux Newbie Guide LinuxSelfHelp Getting Started with Linux Bash Reference Manual Advanced Bash-Scripting Guide Linux Home Networking Virtualiation- Top 10 :hattip: The above links and others can be found at 'Slackware-Links'. More than just SlackwareŽ links! |
how to add line before last 2 lines
It's a script that ads a line at a specific line number
This file is changed almost every day except the last 2 lines. I need a way to add a line always before the last two lines This is my script...But this one ads a new line at linenumber 400. #!/bin/bash k="kbit" read a b c sed -i "400i\ 2 rate $a$k src $b # $c" eth0.cfg sed -i "400i\ 2 rate $a$k dst $b # $c" eth1.cfg Thanks |
All times are GMT -5. The time now is 08:14 AM. |