Search Results

Search: Posts Made By: jimbob01
2,407
Posted By Yoda
if [ "$USER" = "admin1" ] || [ "$USER" = "admin2"...
if [ "$USER" = "admin1" ] || [ "$USER" = "admin2" ]
then
echo "Run scripts here"
else
echo "Run script as admin "
exit 1
fi
2,407
Posted By jlliagre
Your test can't be but true, use an AND, not an...
Your test can't be but true, use an AND, not an OR:

if [[ $USER != "admin1" && $USER != "admin2" ]]; then
...
6,380
Posted By gull04
Hi Jimbob, As I said I'm a bit restricted as...
Hi Jimbob,

As I said I'm a bit restricted as to what I can do with awk, but it may be the variable itself - I'm not sure if it should be prefixed with the $ and enclosed in {} - you could try it...
6,380
Posted By vgersh99
USAGEPERCENT=$( awk "BEGIN{print ${ARR[21]} /...
USAGEPERCENT=$( awk "BEGIN{print ${ARR[21]} / ${ARR[19]}}" )
USAGEPERCENTTOTAL=$( awk -v p="{USAGEPERCENT}" 'BEGIN{print int (p * 100)}' )
33,595
Posted By Corona688
I'll break it down, then. Just...
I'll break it down, then.

Just initialization
N=0
ARR=()
# Special variable which controls when unquoted variables split.
# By default it's space, but we want to split on , for the csv...
33,595
Posted By Corona688
You need the {} brackets. echo ${ARR[2]} ...
You need the {} brackets.

echo ${ARR[2]}

---------- Post updated at 04:45 PM ---------- Previous update was at 04:42 PM ----------

I think I made an error in my original code.

set -- $STR...
33,595
Posted By Corona688
#!/bin/bash N=0 ARR=() IFS="," ...
#!/bin/bash

N=0
ARR=()

IFS=","

while read STR
do
set -- "$STR"

while [ "$#" -gt 0 ]
do
ARR[$N]="$1"
((N++))
...
18,459
Posted By bartus11
Try: awk -F, -vOFS="," '{print $3,$8}' myfile.csv...
Try: awk -F, -vOFS="," '{print $3,$8}' myfile.csv > mynewfile.csv
18,459
Posted By Corona688
First off, awk doesn't know that it's supposed to...
First off, awk doesn't know that it's supposed to split on commas unless you tell it. It won't know to print out commas unless you tell it, either.

# -F controls the input separator. You want ,...
14,500
Posted By frank_rizzo
man grep simple example grep foo...
man grep

simple example

grep foo bar.txt | less
Showing results 1 to 10 of 10

 
All times are GMT -4. The time now is 03:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy