Skip to content
Advertisement

Tag: gawk

How to do parsing of Elapsed time in seconds in linux

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

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=’;’.

Advertisement