Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [awk]

AWK is a text-processing language. It is mainly used to manipulate and process structured data, and to generate reports.

0
votes
1answer
24 views

awk to delete even number file leaving odd number files

In the below awk I am trying to remove the .bam and .bam.bai if the digits after the IonCode_ are even and keep the files if the digits after the IonCode_ are odd. The awk does execute but no files ...
1
vote
0answers
29 views

awk statement to validate and return fixed-structure data lines at start of file

I have a file that starts like this ## CONFIG-PARAMS-START ## ## ## text1 text2 NNNNNNNNN (arbitrary_comment) ## ## text1 text2 NNNNNNNNN (arbitrary_comment) ## ## text1 text2 NNNNNNNNN (...
0
votes
2answers
59 views

awk script to provides a structured listing

I'm trying to create awk script that can provide a structured listing of account information for all UIDs greater than 1000. This is what I tried: This is the expected output BEGIN { FS=":"} $3>...
0
votes
2answers
40 views

AWK to print columns based on the columns summation

I have a file that has numeric values in the form of a matrix. I have written an awk script that prints the header, then adds 1 to the columns 'sum' if the values in the columns are less than 5 and ...
0
votes
1answer
21 views

Add variable space at the end of line in file

I want to add white space at the end of each line. Number of white space is in variable. If number of white space is fixed then I can use this command sed 's/$/ /g' for two spaces. space_variable=...
0
votes
0answers
83 views

find index of a matched substring in a file

I have a file with substrings list like CAACTTCCA TGTATCGTG TTTCAGCTT another file with complete list of strings on separate lines like CAACTTCCAHHHHHCAACTTCCAWWWCAACTTCCA ...
3
votes
2answers
45 views

To override the contents of files

I have two files, file1.txt and file2.txt, file1.txt is: perimeter a=10 perimeter b=15 perimeter c=20 file2.txt is: perimeter a=12 perimeter b=14 Let me know the sed or Perl to override the values ...
0
votes
1answer
42 views

If an empty line is touching another, remove it, otherwise leave it

Regarding is this a duplicate: There are similarly worded questions such as https://unix.stackexchange.com/questions/76061/can-sed-remove-double-newline-characters or https://stackoverflow.com/...
1
vote
2answers
20 views

Use AWK to get last 2 columns of cookie files below comments

I currently have a cookie.txt file that looks like so. # Netscape HTTP Cookie File # http://curl.haxx.se/rfc/cookie_spec.html # This is a generated file! Do not edit. .youtube.com TRUE / ...
1
vote
4answers
92 views

awk, sed, or other text processing suggestions, please

I have the following repeating pattern of text that needs to be reformatted. Normally this should be easy, even with a standard text editor, but in this case I need to expand the information in the ...
0
votes
1answer
17 views

permission script with stat command trouble awk special character

I want to number of permission directory and write a script for equalizing two different server directory. I have use stat command. command: stat /var/ | grep -i 'Access: (' output: Access: (0755/...
0
votes
1answer
51 views

reformat string using sed

I have a file containing lines ["foo"] = ".worldport 0 322.373138 -1487.853882 43.720089", ["bar"] = ".worldport 0 386.938000 212.299000 43.699400", ["baz"] = ".worldport 0 1239.120000 -286.705000 42....
0
votes
1answer
44 views

Replace lines after a given number of matches on separate lines with AWK

Currently I'm using AWK to find and replace a portion of a string after the first three occurrences of a pattern. The string is formatted like this: func(tempID="39849235",count='12');, and there are ...
0
votes
2answers
50 views

How can I get quotes to show up when I'm using AWK to find and replace?

Currently I'm using AWK to find and replace a portion of the first three occurrences of a string. The string is formatted as such, and there are many of these strings in the file: func(tempID="...
-1
votes
1answer
28 views

Manipulating output - awk|sed|grep

I would like to maniputate the following output like this: Output: S* 0.0.0.0/0 [1/0] via 1.1.1.1, MAR-LNK-VGL_DSL [1/0] via 2.2.2.2, MAR-LNK-GVT_DSL [1/0] ...

15 30 50 per page