Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Urgent! UNIX shell scripting question!
#1
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!
Reply
#2
Is this what you are looking for:

sed -${variable}p

- Shadow
Reply
#3
Or:

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

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

- Shadow
Reply
#4
Thankyou very much shadow!

the first one worked perfectly.



Now, onto finishing it.

Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)