I have log file similar to this format Here is the echo command to produce that output $ echo -e “test {nseq-cont {nttt0,nttt67,nttt266nttt},nttgrp-id 505nt}n}ntest{nttest1{nttvalnt}n}n” Question is how to remove all whitespace between seq-cont { and the next } that may be multiple in the file. I want the output to be like this. Preferably use sed to produce the output.
Tag: awk
Filtering on a condition using the column names and not numbers
I am trying to filter a text file with columns based on two conditions. Due to the size of the file, I cannot use the column numbers (as there are thousands and are unnumbered) but need to use the column names. I have searched and tried to come up with multiple ways to do this but nothing is returned to
print specific field from specific line of csv file linux
I am trying to extract a specific field in a specific line of a CSV file. I’m able to do it according to the number row but sometimes the row number of the file will change so this is not that flexible. I wanted to try and do it to extract a specific name before the field I’m interested in.
Combine multiple files csv into one using awk
I want to combine two .csv files based on the unique id that exists in both files. First file consist of 17 columns and the second one in 2 columns where in both files the first column is the same unique id. In the to be created file 3 i would like 18 columns. I have been trying paste paste
Use values in a column to separate strings in another column in bash
I am trying to separate a column of strings using the values from another column, maybe an example will be easier for you to understand. The input is a table, with strings in column 2 separated with a comma ,. The third column is the field number that should be outputted, with , as the delimited in the second column.
Trying to use awk to parse lscpu output but can’t get it right
Essentially what I want is to extract the byte size of the L3 cache from lscpu. The tricky part is that the units lscpu uses is not consistent across versions and what I need has to work with all versions (including the versions before the –bytes option was available). lscpu from what I can see will either use K, KiB,
How to remove the lines which appear on file 1 from another file 2 KEEPING empty lines?
I know that in other questions you solve the first part of “How to remove the lines which appear on file 1 from another file 2” with: comm -23 file1 file2 and grep -Fvxf file1 file2 But in my case I have empty lines separating data sets that I need to keep, for example: File 1: File 2 what I
Replacing a string in the beginning of some rows in two columns with another string in linux
I have a tab separated text file. In column 1 and 2 there are family and individual ids that start with a character followed by number as follow: I would like to replace NA with HG in both the columns. I am very new to linux and tried the following code and some others: Any help is highly appreciated. Answer
Using awk in a bash-script
I’ve been struggling to run an awk result as the arguments of a new awk command within a bash-script; something like this To help eradicate (what I think is) inconsequential code to this problem, gives me and if prepend awk to this result, I get the answer I need. But I’m not able to make it work with xargs; it
Writing a script with ping information into an excel or .csv file
I would like to create a table of min/avg/max ping data using a script. The input would be a .txt of host names and their locations, the output should be a table of those names and their ip address and max, avg and min ping of the command ping -c 10 example.com It would be something similar to this: Answer