awk - pattern-directed scanning and processing language

learn more… | top users | synonyms

1
vote
1answer
19 views

expanding variables in awk [duplicate]

I have around 1000 files where on each of them if the first field matches a specific number , i need to print the corresponding 3rd element . Since the number 7 below, is not constant and it based ...
1
vote
2answers
21 views

Extract Start and End Coordinates according to a defined length of not fixed interval [on hold]

I have a file with intervals starting in the "start" column and ending in the "end" column. I have to extract the start and the end of these intervals according to a defined length that is in written ...
0
votes
3answers
24 views

Group all rows based on the first column then calculate the total of the second and third columns

I need to group rows based on the first column then to calculate the summation of the values of all second row and the summation of the values of all third row. The second column should be calculated ...
0
votes
2answers
28 views

Select the particular range of of fields of a text file

I have a text file filenr.lis contains # 1 2016-05-31-1003-57S._BKSR_003_CM6 # 2 2016-06-01-2255-54S._BKSR_003_CM6 # 3 2016-06-05-1624-57S._BKSR_003_CM6 # 4 2016-06-07-1914-55S._BKSR_003_CM6 ....
-1
votes
0answers
20 views

compare one column to another column to get data [on hold]

File 1: 1343 ASH 601 1376 DAS 602 1298 HQD 682 . . . File 2: DJHG 1343 JJDDJ SCBJA 1376 NADSK JSKDX 1298 BFKJS Output: DJHG 1343 JJDDJ ASH 601 SCBJA 1376 NADSK DAS 602 JSKDX 1298 BFKJS HQD ...
-1
votes
4answers
37 views

how to replace a string in file A by searching string map in file B

I have 2 files, A and B. File A like below, there are several strings in each line like <@userid> <@U39RFF91U> for all the help in this project! Thanks for your help to enhance the data ...
3
votes
1answer
112 views

Using awk to print columns containing multiple patterns

I need to use awk to print the columns containing multiple patterns. I need to print column #2 as well as all the columns containing "config" and "service" respectively. File content: build 345 ...
0
votes
1answer
19 views

Extract info from files to output with filename concatenated and separeted by commas

I have some directory with multiple files with the extention .failed This the number of files can change every day. This files have the following format: file1.failed: FHEAD|4525|20170109000000|...
0
votes
4answers
62 views

pattern replacement using sed [on hold]

Can anyone please suggest how to solve this? Suppose I have a file, and I want to replace the first occurrence of a pattern in matching line with some dynamic value. The pattern here is as. source ...
0
votes
2answers
25 views

Print lines where a specific column has a length condition

I am parsing a very large csv file, where the entry of column 26 has to be of length 10. I can see that there are cases where there are no entries (which is fine), but also cases where the entries ...
3
votes
6answers
643 views

Rearrange file so it is easily readable

I have a few locations that need the WiFi to be checked daily. Currently when I run my script this is the outcome I get. The first name corresponds to the first MAC, the first IP and so on. How may I ...
1
vote
2answers
37 views

how to concatenate next line when condition is true awk

I'm using awk to edit a text file that looks like this : Device_ID Local Intrfce CS_Quimicas_Alim Gig 3/13 computacion_seg_23 Gig 3/14 158 T S MAUSALUD_B Gig 1/40 MULTIAULAS_PRINCIPAL Gig 3/22 173 S ...
2
votes
0answers
24 views

Why the output of “column” is misaligned with a ANSI colored input?

I'm working on a commandline that retrieve some data (curl), extract the relevant fields (awk) and format it (column). It work nice, although it's very ugly (but all my script begin from a "too long ...
0
votes
2answers
37 views

using awk with variables [duplicate]

I am making a word list from all the words typed into a program that will be working with the text entered into it. I want to use a stream editor like sed or awk to search the first word of every ...
1
vote
5answers
58 views

Replacing all non-zero results with “1” to form presence/absence

I have a tab delimited table a b c A 5 2 0 B 0 5 4 C 4 3 4 D 2 0 2 I want to change the non-zero values to "1", without changing the column or row names. Desired output: a b c A 1 1 0 B 0 1 1 ...

15 30 50 per page