I want to do parsing of Elapsed time in seconds .Time formats given below: i’m getting values from systemctl status cassandra | awk ‘/(Active: active)/{print $9, $10,$11}’ Now storing it’s value in variable A,like now A has input as 3 day 18h or 3 day etc. More examples- A=3 day 18h or 3 day or 3h 15min or 3h or
Tag: gawk
Compare multiple columns for each row
Using a csv file, i will like to compare multiple columns to check if all values are the same or not. First row are the headers First column is the label The constant values should be from column 2 to the end ( can be 100 columns ) for the example i put only 8 columns. The purpose is to
Separate Text file to columns by ;
Please I have a text file separated by spaces. I would like to output it to columns separated by ; example Input I use this code My output Output desired. Appreciate your help. Answer $1=$1 is a trick to rebuild $0 with the new separator OFS=’;’.
Using sed piped with w command show user with the largest idle time
the w command produces something like this: I must get a sed script that prints the user with the longest idle time. But the problem is that w shows the idle time in 3 different formats: 1) in seconds: ending with an ‘s’, 2) mm:ss (not ending with ‘m’ or ‘s’), and 3) hh:mm (ending with ‘m’). So I need