MacResource
Urgent! UNIX shell scripting question! - Printable Version

+- MacResource (https://forums.macresource.com)
+-- Forum: My Category (https://forums.macresource.com/forumdisplay.php?fid=1)
+--- Forum: Tips and Deals (https://forums.macresource.com/forumdisplay.php?fid=3)
+--- Thread: Urgent! UNIX shell scripting question! (/showthread.php?tid=5074)



Urgent! UNIX shell scripting question! - microchip13 - 02-19-2006

if I'm trying to do something like 'sed - $variable p' to output a specific line, how would I get it so there aren't any spaces? would I have to use tr?

using the above I get sed - X p when I need sed -Xp


Thanks in advance!


Re: Urgent! UNIX shell scripting question! - shadow - 02-19-2006

Is this what you are looking for:

sed -${variable}p

- Shadow



Re: Urgent! UNIX shell scripting question! - shadow - 02-19-2006

Or:

CMD=`echo "sed -${variable}p"`

then just put $CMD where you want to execute the command.

- Shadow


Re: Urgent! UNIX shell scripting question! - microchip13 - 02-19-2006

Thankyou very much shadow!

the first one worked perfectly.



Now, onto finishing it.

Thanks!