LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-28-2006, 08:00 PM   #1
nickj6282
Member
 
Registered: Mar 2006
Location: Fond du Lac, Wisconsin, USA
Distribution: Debian
Posts: 51

Rep: Reputation: 15
Need help with a script


Ok, I'm hoping someone out there will give me some help on a script. What I need is a bash script that can accept a filename for input and another for output, and remove all lines from that file that start with a certain string. I can do some really really basic bash scripting, but I'm pretty sure I need to use sed for this and I don't know how. Can anyone help me out quick on this? It's for a project.

Thanks a lot,
-Nick
 
Old 03-28-2006, 08:27 PM   #2
cs-cam
Senior Member
 
Registered: May 2004
Location: Australia
Distribution: Gentoo
Posts: 3,545

Rep: Reputation: 57
Quote:
It's for a project.
If I do your schoolwork cause you're too lazy to do it yourself, are you gonna come back and tell me what grade I got? Come off it, half of us have done school already, I'm not going back...

In the way of pointers, sed is probably a pretty easy way to do that. Just read up on the basics of regex and the output of sed --help, that should give you all you need as that task isn't exactly rocket science.
 
Old 03-28-2006, 08:30 PM   #3
nickj6282
Member
 
Registered: Mar 2006
Location: Fond du Lac, Wisconsin, USA
Distribution: Debian
Posts: 51

Original Poster
Rep: Reputation: 15
Yes, I realize that I could go and learn sed, but I've been working all night at this PHP script and I was hoping some kind soul out there would lend a hand. And no it's not a school project, it's a volunteer thing I'm doing (i.e. I'm not getting paid although I should be). But I'll let you know if they like it!

-Nick
 
Old 03-28-2006, 09:25 PM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
sed '/^<pattern to match>/d' script >newscript

If you enter "info:sed" in the konqueror web browser, you'll get the sed manual.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Iptables (with masq) troubleshooting, very simple script attached script and logs. xinu Linux - Networking 13 11-01-2007 04:19 AM
How to start a Tcl/Tk script by simply invoking the script file itself ? cyu021 Programming 2 10-10-2004 11:00 AM
creating shell script that executes as root regardless of who runs the script? m3kgt Linux - General 13 06-04-2004 10:23 PM
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 12:20 AM
linux 9 and java script error - premature end of script header sibil Linux - Newbie 0 01-06-2004 04:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration