AllExperts > Unix/Linux OS 
Search      
Unix/Linux OS
Volunteer
Answers to thousands of questions
 Home · More Unix/Linux OS Questions · Answer Library  · Encyclopedia ·
More Unix/Linux OS Answers
Question Library

Ask a question about Unix/Linux OS
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Denis Mello
Expertise
I have been working with Linux distributions over the last 3 years. I have experience with Linux Security, shell-scripts and network troubleshooting.

Experience
Configuring IMAP, Sendmail, Samba and network connections. Also developed shell-scripts to automated basic functions.
Expert in network security (honeypots, vulnerabilities, tools)

Education/Credentials
Graduated in Mechatronic Engineering, concluded part of a Master Degree in Materials Engineering. Master Business administrator (IT Management).
Microsoft Certified (MCP), Linux LPI, IBM Cerfied in Rational and SAP Netweaver Consultant.

 
   

You are here:  Experts > Computing/Technology > Focus on Unix > Unix/Linux OS > edit stuff

Unix/Linux OS - edit stuff


Expert: Denis Mello - 10/29/2009

Question
Hi Denis,

there exist a script looks like this

expect {
-re ".*X.*" {send "A-specific
";sleep 1}
-re ".*X2.*" {send "A-specific
";sleep 1}
}

expect {
-re ".*X.*" {send "B-specific
";sleep 1}
-re ".*X2.*" {send "B-specific
";sleep 1}
}

expect {
-re ".*X.*" {send "C-specific
";sleep 1}
-re ".*X2.*" {send "C-specific
";sleep 1}
}

expect {
-re ".*X.*" {send "D-specific
";sleep 1}
-re ".*X2.*" {send "D-specific
";sleep 1}
}


If I would like to remove ONLY the snip below

expect {
-re ".*X.*" {send "C-specific
";sleep 1}
-re ".*X2.*" {send "C-specific
";sleep 1}
}

I need the output to be this

expect {
-re ".*X.*" {send "A-specific
";sleep 1}
-re ".*X2.*" {send "A-specific
";sleep 1}
}

expect {
-re ".*X.*" {send "B-specific
";sleep 1}
-re ".*X2.*" {send "B-specific
";sleep 1}
}


expect {
-re ".*X.*" {send "D-specific
";sleep 1}
-re ".*X2.*" {send "D-specific
";sleep 1}
}

can sed or awk work this out?
if not..
maybe other tools suggested?

Answer
Hi there. I was testing your shell script but I think that it is only a part of a bigger script, isn't it?

Can you provide more information about it, such as:

- The purpose
- the platform running (O.s)
- the shell type
- a little bit more of the shell-script.

I want to study it more in order to give you a more accurate response. Sorry for responding you so late.

Best regards.

Denis Vinny!

Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.