The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
"BOLD" printing a variable in PS1 command pdtak Shell Programming and Scripting 4 03-17-2008 01:04 PM
passing a variable inside a variable to a function KingVikram UNIX for Dummies Questions & Answers 2 01-14-2008 05:28 PM
Export command giving Variable Name vs the Value set for the Variable ParNone UNIX for Dummies Questions & Answers 2 04-03-2006 08:43 AM
ksh: A part of variable A's name is inside of variable B, how to update A? pa3be Shell Programming and Scripting 4 03-30-2005 08:29 AM
Printing Problems in unix ... ( Bar-cdoe - Ip Printing) QuickSilver UNIX for Advanced & Expert Users 3 06-04-2002 07:48 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 03-16-2008
Registered User
 

Join Date: Dec 2007
Posts: 34
sed not printing variable

I have the following string stored in a variable from a file

sbCvgXfsuupllsucpp11-aWa

I want to use sed to search for the string in a second file: FileSys.dat

sed -n "${obid}" FileSys.dat

I'm getting "sed: command garbled: sbCvgXfsuupllsucpp11-aWa"


The syntax seems fine...anyone know why sed cannot execute the above?

thanks
Reply With Quote
Forum Sponsor
  #2  
Old 03-16-2008
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,664
sed doesn't have a sbCvgXfsuupllsucpp11-aWa command listed on my sed man page. To get a listing of all of the line in a file that contain the string sbCvgXfsuupllsucpp11-aWa you might use grep...

grep sbCvgXfsuupllsucpp11-aWa /path/to/file

fgrep would probably be faster. A sed command to do this would be something like:

sed -n "/sbCvgXfsuupllsucpp11-aWa/p"
Reply With Quote
  #3  
Old 03-16-2008
Registered User
 

Join Date: Dec 2007
Posts: 34
got sed to print my variable

Perderabo,

I just got sed to print my variable by adding double quotes around my /

sed -n "/${obid}"/p" FileSys.dat



thanks,
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 11:41 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0