I'm trying to write my own script to tell me if I've used more than 500 MiB of my data.
I'm using vnstat -d for the information about data usage.
vnstat -d Output here

Output should be:
- Only from the "Total column"
- Only have values greater than 500.
I want only values from the "total"column. My output lists data from all the columns. Better clear from the following:
#!/bin/bash
for i in `vnstat -d | grep -a [0-9] `; //get numerical values in i (-a tag as vnstat outputs in binary)
do
NUMBER=$(echo $i | grep -o '[5-9][0-9][0-9]'); //store values >500 in a var called NUMBER
echo $NUMBER;
done;
I'm a self-learning newb here so please try not to bash (pun) me.
Current output which I'm receiving from above script:
600
654
925
884
923
871
967
868
My desired output should be:
654
923
967
output_cmd | awk -F\| '{print $3}could get your started. Read the awk tutorial . Good luck.totalcolumn.grep -o '[5-9][0-9][0-9]', which searches all numbers in the line and not only the one in the column titled total.