Thursday, 12 September 2013

Cut the output of a command

Cut the output of a command

I have the following output of the command "xm list":
Name ID Mem VCPUs State
Time(s)
Domain-0 0 505 4 r-----
11967.2
test1 28 1024 1 -b----
137.9
test2 33 1024 1 -b----
3.2
I execute a shellscript with: ./myscript test2 In this script, I need the
ID of test2 (shown at the command "xm list" (ID33)) I tried it with grep
and cut like this:
xm list | grep $1 | cut ???
How does this work?

No comments:

Post a Comment