Skip to content

Tag: awk

Renaming sub-directories recursively to a new pattern in bash

I want to rename sub-directories to my new pattern but some results may be dangerous in my own script: For example if I use /tmp/etc as input argument I would have the nasty results in the first iteration: So in next iteration there will not be /tmp/etc to work at. The second problem in my script is when I us…

Skipping a part of a line using sed

I have a file with content like so – @1: 00001109 Each line is of the same format. I want the final output to be @1: 00 00 11 09. I used command in sed to introduce a space every 2 characters – sed ‘s/.{2}/& /g’. But that will give me spaces in the part before the colon too which

Search for log having value greater than certain time

Below is the sample log: Below is the desired output: When I use awk if it is exact time it will display the output otherwise it not displaying the output. Below is the code: Not displaying output: Displaying output: Besides that I got to find a solution. Below works but not as expected. Displaying output as …

implementing Excel if-like function with AWK

I have a question about Excel-if-function implementation with AWK. I have a csv file having eight columns like below: Each field can take only integer values from 1 to 6. I would like to give one point if the first column is 1. In other cases, the score would be zero. In this MWE case, the point for all three