LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 04-28-2004, 05:45 PM   #1
sphynx
Member
 
Registered: Feb 2002
Location: /usr/home
Distribution: Ubuntu / Gentoo / Whatever
Posts: 67

Rep: Reputation: 15
last sed question of the week


last sed question lol. ok i have a variable $1. this is a string to search for in a file called temp.

so what i want to do, is have sed go through this temp file, and if it finds $1, i want it to send that to another file called tempmusic. then i'm going to cp tempmusic to music. $1 will be the the full or partial name of a band. like 98 degrees or something. there will be only one band name per line, but there could be many lines per band. so all i need it to do is take $1, and get it into a file called music. again, sed will be reading from the file: temp. I have no idea how to search for a string using $1, cuz i want the contents of it, not a literal $1. also, like if $1 were "Stwain", i want sed to find both Stwain01, and Stwain02. thanks in advance. here is an example file

Stwain01
Stwain02
Efitzgerald
98degrees01
98degrees02
98degrees03
Lwelk

Last edited by sphynx; 04-28-2004 at 05:54 PM.
 
Old 04-28-2004, 06:44 PM   #2
sphynx
Member
 
Registered: Feb 2002
Location: /usr/home
Distribution: Ubuntu / Gentoo / Whatever
Posts: 67

Original Poster
Rep: Reputation: 15
w00t i got it. thanks anyway.
 
  


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
sed question tifu Programming 5 03-18-2005 12:02 PM
sed question lazyuser Programming 4 02-11-2005 06:11 AM
General MPlayer Question, 1-week newbie johngcarlsson Linux - Newbie 5 07-29-2004 10:33 AM
sed question sphynx Programming 6 04-28-2004 06:25 PM
sed question 360 Programming 2 03-15-2002 09:52 AM

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

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