Skip to content
Advertisement

Tag: awk

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 expected: Displaying output. Expecting

AWK: Comparing substrings from two files and write to third file

I’m trying to compare two different files, let’s say “file1” and “file2”, in this way. If the substring of characters i.e 5 characters at position (8 to 12) matches in both files – file1 and file2, then remove that matching row from file 1. Finally, write the output to file3.(output contains the remaining rows which are not matching with file

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

Advertisement