grep/sed/awk a specific word from a table [closed] - bash

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
The list looks like something this:
9 vm_mail running
11 vm_webserver running
13 vm_proxy running
15 vm_wsus running
Now i only need the vm name in the middle while only using "vm" as searchterm
any ideas?

grep -Po '(?<=vm_)\S*'
gives you:
mail
webserver
proxy
wsus

Related

I need some ideas fo writing a self-destroying program [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 days ago.
Improve this question
it should be compiled and started only x times and then not anymore, should also be not hackable. for example no use of lock file.
maybe a use-counter in the binary?
im expecting suggestions to my problem here.
For this must use destructur.
Destroyed variables after scope and must nul

Specify a particular machine name on slurm [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
Hello does someone know how to specific on a slurm file which worker (machine) I want to use ?
Thank for your help
You can specify the nodes that you would like to select with the --nodelist option:
sbatch --nodelist=myHosts[1-5,7] script.sh
More details are described here.
A shorthand version of --nodelist is -w.

How to use min in formula [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
How to min inside the formula to evaluate using eval().
[5,6].min works fine but it doesn't work inside the formula eval([5,6].min*5).
Here is a way using #eval. But why you need #eval ?
eval('[5,6].min * 5')
# => 25
Simply [5,6].min * 5 will work for you.
You don't need eval.
[5,6].min*5.

Reuse of the same variable wit using echo and cut [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm try to make a script for checking some ethx.
If the eth is up and connected my script is working
When its not working I have a problem.
RESD=$(ssh -q vmx#$1 cat /sys/class/net/$3/dormant)
I get in RESD the following result:
cat: /sys/class/net/eth3/dormant: Invalid argument
I want to put in RESD now the first letter.
How can I do this?
Thanks
As per the comment above, this what you want to do: RESD=${RESD:0:1}? This is pure bash equivalent of RESD=$(echo $RESD | cut -c1).

Unix: Trying to increment a calender year and display [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have a unix assignment and What I have isnt working right. It doesnt format like the normal "cal" function.
#!/bin/bash
d=`date '+%Y'`;
$((++d));
calstr=`cal $d`;
echo $calstr;
You don't need the $ in line 2, and you need to wrap the $calstr in double quotes:
#!/bin/bash
d=`date '+%Y'`;
((++d));
calstr=`cal $d`;
echo "$calstr";

Resources