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

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

1 Answer 1

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.