Skip to content

Tag: awk

Using sed/awk to extract multiple strings from each line

I have a file that contains 30million lines(so big file) On each line I have this kind of data: I need to extract both the title value and the rank value so: Little help? 🙂 I have tried my little heart out and nothing, can only extract one piece of data from each line Answer Except in the case there

Filling empty spaces in a CSV file

I have a CSV file where some columns are empty such as How do I replace all the empty columns with the word “empty”. I have tried using awk(which is a command I am learning to use). I want to have I tried to replace just the 3rd column to see if I was on the right track this left

Print value of by loop in the end of line in bash

My file which run loop… My program file My result is My should I do so result come like I will be very glad if someone can help me out, Answer A possible solution would be to replace the line: echo $country >> /wdc-cron/count-$yesterday.txt with: printf “$country, ” >> /wdc-cron/…

Use awk command to get information below a pattern

I have a file with a wide range of information and I want to extract some data from here. I only will post here the interesting part. I want to extract IQ and JQ values as well as the J_ij[meV] value which is two lines above. I read this question How to print 5 consecutive lines after a pattern in

Remove column matching 2 patterns with AWK

Multiple lists of Books with ISBN,TITLE,OBSERVATION and other with OBSERVATION,TITLE,ISBN, I want remove column OBSERVATION, print TITLE as 1st column and ISBN as 2nd as follow. Input: 123654 Cosmology Updated 35647 Medecine Revised 987456 Juriprudence Revised Updated Rhetorics 123456 Revised epistomolgy 6543…

remove character on the last line that specific word appears

we have the following file example we want to remove the , character on the last line that topic word exists expected output we try to removed the character , from the the last line that contain topic word as the following sed cli but this syntax not renewed the , sed (GNU sed) 4.2.2 Answer In case you have

Bash issue with floating point numbers in specific format

(Need in bash linux)I have a file with numbers like this Any way possible I can do these 3 steps? 1st I try this then then Final 1 line solution Answer Your “final” solution: should avoid the useless cat, and also move the backslash in the sed script to the correct place (and I added a ^ anchor an…