Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This command gets my ip address:

who am i|cut -d "(" -f2 | cut -d ")" -f1


this command sends a ZPL command to on port 5964:

printf '\x5eXA\x7eSD30\x5ePR6\x5ePW544\x5eLL0333\x5eML39,989\x5eJM1280,12\x5eID\x5eJUS\x5eXZ\x5eXA\x5eWD\x5eXZ'|nc 5964

but if I replace with who am i|cut -d "(" -f2 | cut -d ")" -f1 like this:

printf '\x5eXA\x7eSD30\x5ePR6\x5ePW544\x5eLL0333\x5eML39,989\x5eJM1280,12\x5eID\x5eJUS\x5eXZ\x5eXA\x5eWD\x5eXZ'|nc who am i|cut -d "(" -f2 | cut -d ")" -f1 5964

then I get:

nc: port range not valid
cut: 5964: No such file or directory

What is the correct syntax to write it on one line?

share|improve this question
up vote 1 down vote accepted

I think this should make it

$(who am i|cut -d "(" -f2 | cut -d ")" -f1)

printf '\x5eXA\x7eSD30\x5ePR6\x5ePW544\x5eLL0333\x5eML39,989\x5eJM1280,12\x5eID\x5eJUS\x5eXZ\x5eXA\x5eWD\x5eXZ'|nc "$(who am i|cut -d "(" -f2 | cut -d ")" -f1)" 5964
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.