Search Results

Search: Posts Made By: xcod3r
1,429
Posted By kshji
awk ' BEGIN { FS=":" } ...
awk '
BEGIN {
FS=":"
}

{ # default for all lines
color="yellow"
}

$1 == "red" {
color=$1
}

{ # all lines
...
1,429
Posted By RudiC
As you don't assign FS (the field separator), the...
As you don't assign FS (the field separator), the default (multiple white space) is taken. Thus $1 is always the entire line, "red" is not found, and the else branch of your if construct is taken....
1,884
Posted By Scrutinizer
The code is putting a new value in _status on...
The code is putting a new value in _status on every line and it reports the last _status in the END section. The last line is OK, so that is what gets printed.
1,884
Posted By RudiC
You print the status for the last disk mounted...
You print the status for the last disk mounted only. Try printing the status for every disk by moving the print from the END section into the "Normal" section right after the if ... else construct.
Showing results 1 to 4 of 4

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