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. Use this tag only if your question relates to programming using AWK or AWK-based APIs. Questions relating to using or ...
1
vote
3answers
38 views
Filter file with findstr or awk and sed
I am trying to filter this file based on the backslash before a semicolon, for example filter the file below to obtain the lines that contain up to six backslashes before a semicolon
\\...
0
votes
3answers
41 views
How to print the data that have largest length using awk?
I have this input:
1 happy,t,c,d
2 t,c
3 e,fgh,k
4 yk,j,f
5 leti,j,f,g
I want to print the length of the largest item (with comma as a delimiter), which should yield:
1 5,1,1,1
2 1,1
3 1,3,1
4 ...
0
votes
2answers
39 views
Matching two files
I want to make a matching between two files on Linux
I have two files:
File1 (3 fields, separated by |)
M000990520|CAMPOS HORMAZA MIGUEL | 1,725.30
M000990521|MATEO MIGUEL ZENON | 1,143.86
...
1
vote
4answers
35 views
Print Entire Row When Second and Third Columns Match Numeric Pattern
I need to print the entire row when the 2nd and 3rd columns of a CSV match two floating point values, i.e. 36.*,-125.*.
Sample CSV (col2):
54.43,36.01,-125.54
60.32,45.32,-86.21
32.67,20.55,-30.78
...
-1
votes
0answers
40 views
insert statement with awk command
I have a huge .csv file which needs to be inserted into an Oracle data base.
For that purpose I've designed an awk command but the output inserts a new line at the end of the command, this is an ...
-1
votes
0answers
58 views
Concatetating awk variables or sed variables
#!/bin/bash
domain="$(sed -n 's/^domain://p' file.txt)"
address1="$(sed -n 's/^address1://p' file.txt)"
Organisation1="$(sed -n 's/^Organisation1://p' file.txt)"
phone1="$(sed -n 's/^phone1://p' file....
0
votes
2answers
35 views
Awk exchange values from different columns
I have a file of the following structure:
4 1:4 3:1 6:1 56:2 57:4 58:7 59:1 66:2
1 2:1 56:1 57:1 58:2 59:2 65:1
8 1:2 2:1 3:8 12:1 56:1 57:2 58:2 59:2 66:1 67:2
What I need to do is to switch the ...
0
votes
1answer
48 views
Comparison Between 2 FIles and Printing the Result in a Desired For at using AWK [duplicate]
My files are as below:
File 1:
COL1|COL2|COL3|COL4|COL5
'SR'|'2017-09-01 00:19:13'|'+05:30'|'1A3LA7015L5S'|'5042449536906016501541'
'SR'|'2017-09-01 00:19:20'|'+05:30'|'1A3LA7015L6I'|'...
-4
votes
2answers
58 views
Match the string between two braces & comment the lines between the braces [on hold]
We would like to match the string sysstat & comment all the lines within the flower bracket which match the string sysstat.It shouldn't affect the other flower brackets if it doesn't match the ...
1
vote
2answers
36 views
Keep rows from file 1 matching values from file 2 using awk
Contents of the Main File-
$ cat Sort_File2.csv
'SR'|'2017-09-01 00:19:13'|'+05:30'|'1A3LA7015L5O'|'5042449534546015801549'
'SR'|'2017-09-01 00:19:13'|'+05:30'|'1A3LA7015L5O'|'...
2
votes
2answers
46 views
Remove 4 chars before the last char with sed (or awk)
I would like to remove the 4 chars before the last char.
Input:
abc2a982
e1kei9e5bc5
e1edeaww58476
Expected output:
abc2
e1kei95
e1edeaww6
So far I have tried:
cat file | while read line; do ...
0
votes
1answer
36 views
Inner join two files based on one column in unix when row names don't match with sort
I'm running into an issue trying to join two datasets in unix and could use your help. I've spent a long time searching the forum for a solution but turned up empty handed.
I have a list of accession ...
0
votes
1answer
25 views
How to print lines based on values in multiple columns
I'd like to print every line in my file that satisfies the following:
print line if column 3 or column 4 or column 5 is less than 10
Example
Emma A 10 4 7
Sally A 4 4 7
Jack B 15 19 ...
-3
votes
2answers
52 views
Bash code to struture proteomics data
I need help concerning retructuring my dataset so that I can perform the downstream analysis. I am presently dealing with proteomics data and want to perform comparative analysis. The problem is the ...
0
votes
2answers
33 views
AWK: Generate two output files with different OFS
Disclaimer: I know this problem can easily be solved using tr and others, but I am curious to make it work in awk only.
I want to generate two output files (same content) with different OFS using awk....