LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-24-2008, 08:11 AM   #1
jaykup
Member
 
Registered: Jan 2006
Location: Mukwonago, WI
Distribution: Slackware 12
Posts: 77

Rep: Reputation: 16
simple sed question


I want to run a sed script only on the lines that contain "^http"

sed '/^http/ {-f urlencode.sed}' list.m3u

doesn't work.. what do I need to do?
 
Old 01-24-2008, 08:32 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
sed -f urlencode.sed list.m3u

In the sed script include commands that only operate on lines starting with "http" for example:
/^http/s/dogs/cats/g
/^http/s/horses/pigs/g
 
Old 01-24-2008, 08:49 AM   #3
jaykup
Member
 
Registered: Jan 2006
Location: Mukwonago, WI
Distribution: Slackware 12
Posts: 77

Original Poster
Rep: Reputation: 16
Thanks! That makes perfect sense now.
 
Old 02-25-2008, 01:23 AM   #4
KEYofR
LQ Newbie
 
Registered: Jun 2004
Location: Edison, NJ
Distribution: SuSE, Knoppix, Ubuntu, FreeBSD, SCO Open Server
Posts: 7

Rep: Reputation: 1
"If you see the "read" command in a bash script, it is probably wrong."

Love it! As a long time ksh fan, I have been waiting a zillion years for the oh so whizbang bash and zsh to catch up wrt read and having sleep built-in and others ...
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple sed problem need help Silvermask Linux - Software 2 04-12-2007 01:15 PM
Simple question about sed or awk setianusa Programming 2 09-16-2005 03:57 PM
Simple bash/awk/sed scripting question R00ts Programming 4 04-16-2005 02:55 AM
Simple Text Reformat (sed and grep) mikefazz Programming 2 08-31-2004 07:38 PM
using sed, simple question bobthebat Programming 3 04-30-2001 10:01 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:09 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