awk's questions - English 1answer

4.058 awk questions.

I need to replace all spaces which exist within quotes. I have several columns yet only one column has quoted output containing spaces which is throwing off my columns when using column -t "UDP ...

I am currently working with data of many merged .csv files. Unfortunately, those merges are faulty sometimes. This is best explained by this example: "var1", "var2", "var3", "var4", "var5" "...

I have a pattern variable with below value: \"something//\\anotherthing' and a file with below contents: \"something//\\anotherthing' \"something//\\anotherthing \"something/\anotherthing' \"...

I'm trying to summarise this list to contain only 5 days worth of data, from today to 5 days ago. I tried using awk but to no avail. There is no need to stick to awk too. This is the output: This is ...

CLASS RECORD OF THE STUDENT FROM THE PREVIOUS BATCH WHO TOPPED Name (Roll no) # Location Section Rank (MARKS) Gender Anna (+) USA A1 First (100) Female (...

I have multiple files with different number or records in each. I want an awk command to print the second last line of them and perform some change. I want something like this:(this one doesn't work ...

I have a poem with an unknown number of rows and I want to display only the penultimate one. What command should I use?

I have two files in these formats: file1 : air smell hand dude road cat file 2: air,4,21,01,13,3,2 smell,21,4,2,5,6 dude,1,31,42,1 road,1,4,2,1,4 cat,1,5,6,3,1 hand,1,4,2,1,6 mouse,1,3,5,6,2 ...

I have two files genelist.txt and data.txt. genelist.txt simply contains a single column of ~500 gene names, whereas data.txt is a tab delimited file that contains ~1000 columns (the samples) and ~30,...

I have a text file which has following content DESCRIPTION ENABLED Tracker_EG32747257_0418_0618, {NAME => d, DATA_BLOCK_ENCODING => NONE, BLOOMFILTER => ROW, REPLICATION_SCOPE => 0, ...

I have two fields in logs sending time and received time mentioned in milliseconds, I have to find difference between these two fields, if it's greater than 2 seconds print those logs using shell ...

I have a file with data like this vserver-1 vserver-1_root 0.95 0.0019043 0.948047 vserver-1 home 10.00 8.25 1.75 vserver-1 usr 95 45.65 39.35 vserver-1 file0 100 89.15 10.85 Desired formatted ...

Input csv file : key,c1,c2,c3......,cn 1,car,phone,cat,.....,kite 2,abc,def,hij,.......,pot 1,yes,no,is,.........,hello 2,hello,yes,no,......,help Output csv file: Key,c1,c2,c3,.......,cn 1,caryes,...

I am trying to extract the column name with the maximum value in each row using bash script i.e., the column header value or the value from the same column in the first row. I am using the following ...

I want to insert a new line in two lines before the last line. So if my original file is: 1 2 3 4 5 The result should be 1 2 3 New line 4 5

I need to reformat the output of the following command using awk for static and dynamic column numbers: ps -eopid,lstart,cmd | grep java |grep -v grep following would be sample input to the awk ...

I have a file that has thousand of lines, looking like this: C509.TCGA-78-7159-10A-01D-2036-08.1-C509.TCGA-78-7159-01A-11D-2036-08.1 DNAH7 0 1 1 0 1 1 C509.TCGA-78-7159-10A-01D-2036-08.1-C509.TCGA-...

How can I add a Column of values in a file which has a certain number of rows. I have a input file like this: Input file: SPATA17 1 217947738 LYPLAL1 1 219383905 FAM47E 4 77192838 SHROOM3 4 ...

How come echo `echo "foo"` works but echo `awk '{ print "foo" }'` doesn't?

I have a lot of form letter need generate. $>cat debug-form-letter The first field is $1, the second $2, the third $3, the 10th field is $10,but the 10th correct value is varA. $...

How can I print lines which have duplicate (x2) values ? E.g 01 02 03 01 01 03 01 01 01 03 out of these three lines, only line two is correct. so now let's say I want to look up for line where the ...

I have the following lines in my awk program : str = gensub(/`([^`]*)`/, "\\\\texttt{\\1}", "g", str); str = gensub(/\*([^\*]*)\*/, "\\\\textbf{\\1}", "g", str); These lines perform non-greedy ...

The following code results in an infinite loop because awk doesn't support local variable in { … } scope. #! /usr/bin/gawk -f function myfunction() { for (i = 5; i < 8; i++){ print "...

I have a variable called DISK_INFO with the following contents: diskid HGST HUSMH8010BSS204 serial no no [0] Slot00 diskid HGST HUH728080AL4204 serial no no [...

I just encountered with a question. It is very similar to what I already asked before how to copy a column from another file when the ID's matches, with some differences. I have a folder (folder1)...

From a previous command in the Linux Terminal (teqc +qc filename), I receive the following output directly in the Terminal: QC of RINEX file(s) : whcr0010.18o ********************* 4-character ID ...

I wrote this script for logging emails if disk-space is more than 90. Please help me get the output in separate lines. Here is my code: #!/bin/bash errortext="" EMAILS="abc@xyz.com" for line in `...

I have a CSV file with 150+ columns, with the new line character as a record separator. The problem lies in one of the columns getting new line characters. For this, I want to remove those. Input: ...

File (myfile.txt) contains data as follows: abc#ab1=23 nrt# #clb1aX amd#322 Desired Output: abc nrt clb1ax amd I could do like this, for i in `cat myfile.txt` do s1=`echo $i | cut -d'#' -f1`; ...

I've got it working as expected when looking at 1 column: cat /tmp/inputfile | awk -F : '$12 !~ /100/ { print $6,$12,$13}' cat /tmp/inputfile | awk -F : '$12 ~ /100/ { print $6,$12,$13}' 4726753 100 ...

I'm looking for an awk solution to get from this table (with x number of names in column 1, and different lengths of column 2 which is ";" separated): dataframe.txt: name1 1;2;4;8 name2 4;5;7 name3 ...

Awk Gurus, Need a small help here, please My input file is: puloto_cluster_b_02_sys puloto_cluster_b_02_sys puloto_cluster_b_generic_cg puloto_cluster_b_02_temp ...

I have a file with hundreds of paragraphs of around 15 lines each. I need to search for a pattern, say Occurrence: 1. If this pattern is found in the para, I need to print the entire paragraph. Note ...

I have a document I'm formatting, it contains 1/2 million lines of text and are basically identical to the example below. I need to delete the the tab in between the two letters, so that this: ...

I am in the habit of writing one line per sentence because I typically compile things to LaTex, or am writing in some other format where line breaks get ignored. I use a blank line to indicate the ...

How can I count the number of occurrences of a substring in a string using Bash? EXAMPLE: I'd like to know how many times this substring : Bluetooth Soft blocked: no Hard blocked: ...

I have 100 csv files each containing 2 columns. The first is taxonomy and the second counts. Each file has about 10000 rows. The taxonomy data in each file is only partially shared with a total of ...

Is there a way to match some Unicode range exactly. Let's use the Cyrillic range as an example: U+400 to U+52f The whole range of chars could be printed (from bash or zsh) with: $ echo -e $(printf '\...

I want to remove lines with digits at the end of the string, example of input: example123 example example12 example43 expected output: example

This example works fine: awk -v num1=5999 -v num2=5999 'BEGIN{ print (num2==num1) ? "equal" : "not equal" }' equal This example does not work well: awk -v num1=59558711052462309110012 -v num2=...

Related tags

Hot questions

Language

Popular Tags