Questions tagged [awk]
AWK is an interpreted programming language designed for text processing and typically used as a data extraction and reporting tool. AWK is used largely with Unix systems.
33,121
questions
0
votes
0
answers
36
views
Is there an awk function for filtering values greater than 'x' in a multi-value column? [closed]
I have data where there are multiple values in a single column, each separated by a comma. I want to print the ID in the first column, and print values in the third column that are greater than 199. I ...
-2
votes
4
answers
97
views
How to append some static content within a single cell of an existing CSV file
Let's assume I need to append the below content within the first cell (not be row by row) of the existing CSV file which has details of the customer. How can I achieve it?
Content to be added:
"...
-1
votes
5
answers
112
views
How do I delete all the lines that match and one after each of them?
I have a large file and a list of my specific strings. The output should not contain my specific lines and one more after each of them. 2 consecutive matches are impossible due to structure of file ...
0
votes
2
answers
57
views
passing "-e" as a parameter to awk is having unexpected results
I have short Bash script that will not pass "-e " to Awk:
str="Morgenstern"
ex = "-e "
for i in {1..11}
do
echo $(echo $str| awk -v vv="$i" -v xx="$ex&...
1
vote
5
answers
97
views
How to add headers to a CSV file which already has some headers in it
My requirement it to add the new headers to an existing CSV file which already has some headers in the fist line. I need to add the new headers at the end of the existing headers. The value of the new ...
0
votes
2
answers
68
views
Use AWK to detect when a column doesn't increment correctly [closed]
I have a large text file with many columns of data. One of those columns is a ping counter" which is a hex number that should increase by 1 each line. Skipping a value, repeating a value, or ...
0
votes
1
answer
53
views
Grep a row and retain only matching rows based on a specific column in bash [closed]
I'm working on a project where I need to extract specific gene neighborhood information from a dataset based on protein accession IDs. I have a series of .acc files containing protein accession IDs, ...
-1
votes
0
answers
34
views
How to Store awk filtered text as a dictionary in bash script [duplicate]
I'm trying to store a filtered output using awk (two values) as a key value pair and iterate through that.
I get the values interested but need some help in putting it as a key:value pair
AC-Info: ...
-3
votes
0
answers
44
views
Output lines from a file that match pattern 1 and not pattern 2 in linux [duplicate]
I have a text file that has a bunch of lines. I used grep to print lines matching pattern 1 to a second file. I want to modify the command to exclude the lines the match pattern 2. So the requirement ...
-1
votes
3
answers
108
views
How to find strings in multiple lines of txt file then add all to new csv line
I have thousands of txt files that were converted from emails that included a "Contact Us" form. I need to find/select strings in the second "column", but the number of lines to ...
1
vote
4
answers
158
views
How to properly escape single quotes in filenames?
I have files with single quotes in their name, say o'a. I want to process them in awk (gawk-5.3.0):
(fd is an alternative to find).
Please don't tell me about fd -x option, my command is snippet of a ...
3
votes
3
answers
69
views
Explanation about awk matching a pattern between a range of lines
I have an Awk one-liner that, while I understand what is being accomplished at a high level, I don't fully understand how Awk is accomplishing the task I give it. I'm asking Awk to give me a range of ...
0
votes
0
answers
38
views
capture hash value from git log --oneline --graph using regex [duplicate]
When running git log --oneline --graph you can get something like this
* 7e5dbb0 Merge
|\
| * c873a96 My
| * f5817ba Amazing
* | f6a34ac Feature
|/
* f5a51ce Other stuff
I want to take that and ...
1
vote
4
answers
116
views
Awk /Sed or TCL script to search series of patterns
I am having one File as stated below
File 1
Module1 (a dd ddd )
jdjd ikdnd kdndn didkdn;
jdjdjl kdkdk kdkd lkd;
Ann {"Load DR"} ;
V { REST_TMS=1 ;
REST_TDI = 0
REST_TCK=1 ;
...
5
votes
7
answers
271
views
gawk hangs when using a regex for RS combined with reading a continuous stream from stdin
I'm streaming data using netcat and piping the output to gawk. Here is an example byte sequence that gawk will receive:
=AAAA;=BBBB;;CCCC==DDDD;
The data includes nearly any arbitrary characters, but ...