awk Questions

3

Solved

The section 3.4 Using Bracket Expressions of GNU awk manual, reads To include one of the characters ‘\’, ‘]’, ‘-’, or ‘^’ in a bracket expression, put a ‘\’ in front of it. For example: &nbsp...
Foreigner asked 2/11 at 14:38

4

Solved

I need to change the order of a string in AIX, but with the command cut I can't do it Ex: echo FT0215202301.xml | cut -b 7-10,5-6,3-4 Result: 02152023 Expected: 20230215
Cesar asked 23/9 at 19:15

3

Solved

I'm trying to add a column (with the content '0') to the middle of a pre-existing tab-delimited text file. I imagine sed or awk will do what I want. I've seen various solutions online that do appro...
Callimachus asked 14/8, 2012 at 10:45

4

Solved

I have a file with 4 million of lines, every line ends with the char $, but I mistakenly add a new line after the the line delimiter while scraping a website, so right now it is looking like this: ...
Duckbill asked 13/3, 2014 at 0:16

7

Solved

I have a file with an identifier and a value: ABC123 111111 ABC123 111111 ABCDEF 333333 ABCDEF 111111 CCCCCC 333333 ABC123 222222 DEF123 444444 DEF123 444444 Both columns contain duplicate values,...
Irenairene asked 20/8 at 19:36

5

Solved

here is column 6 in a file: ttttttttttt tttttttttt ttttttttt tttttttattt tttttttttt ttttttttttt how can I use awk to print out lines that include "a"
Anechoic asked 12/12, 2011 at 21:30

6

Solved

I have a valid YAML: --- name: first metadata: a --- name: second metadata: b --- name: third metadata: c How can I split it using a one-liner AWK script in files first.yaml, second.yaml and thi...
Ette asked 19/12, 2019 at 6:50

1

Solved

This it taken from the "awk-exercises". For the input file patterns.txt, filter lines containing three or more occurrences of "ar" and replace the last but second "ar&quot...
Universalize asked 29/7 at 13:6

8

Solved

I have pattern like below hi hello hallo greetings salutations no more hello for you I am trying to replace all newlines with tab using the following command sed -e "s_/\n_/\t_g" but it's not...
Ecthyma asked 24/10, 2009 at 11:23

8

awk -F: '{ printf "%-3s %-2s","\n" $1 $2; }' How do i add in color code? '\e[1;32m' I try adding in to printf, it give me output of the string instead of color code.. '\e[1;32m' .......
Gaggle asked 23/1, 2013 at 14:30

6

Solved

I want to select line of a file where the absolute value of column 9 is less than 500. Column is sometimes positive, sometimes negative. awk -F'\t' '{ if ($9 < |500|) {print $0} }' > output....
Corrugate asked 25/6, 2012 at 7:12

7

Solved

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, ...
Turkic asked 3/7 at 3:57

5

Solved

I have nearly 200 files and I want to find lines that are common to all 200 files,the lines are like this: HISEQ1:105:C0A57ACXX:2:1101:10000:105587/1 HISEQ1:105:C0A57ACXX:2:1101:10000:105587/2 HIS...
Peaceful asked 13/2, 2020 at 14:15

7

Solved

I have three types of strings that I'd like to capitalize in a bash script. I figured sed/awk would be my best bet, but I'm not sure. What's the best way given the following requirements? single ...
Granvillegranvillebarker asked 3/8, 2012 at 21:14

8

Solved

I want to print lines from their beginning to selected characters. Example: a/b/i/c/f/d a/e/b/f/r/c a/f/d/g a/n/m/o a/o/p/d/l a/b/c/d/e a/c/e/v a/d/l/k/f a/e/f/c a/n/d/c Command: ./hhh.c...
awk
Gielgud asked 14/6 at 6:15

5

Solved

Is it possible to have an awk command within a bash script return values to a bash variable, i.e.,if my awk script does some arithmetic operations, can I store the answers in variables so, they can...
Stopple asked 14/3, 2012 at 18:36

4

Solved

I would like to extract sequences from the multifasta file that match the IDs given by separate list of IDs. FASTA file seq.fasta: >7P58X:01332:11636 TTCAGCAAGCCGAGTCCTGCGTCGTTACTTCGCTT CAAGTC...
Kalin asked 9/4, 2018 at 11:1

0

I am trying to create a gawk extension that adds the ability to register signal handlers for specific signals in gawk which currently there is no built in way to do. After reading the gawk document...
Maroc asked 10/6 at 3:35

2

Solved

I'm running an awk script on a 100G+ file. I have a suspicion that since it never finishes it got into some kind of infinite loop. I want to see the line that script is currently at to see if there...
Daub asked 20/7, 2022 at 21:43

4

Solved

I want to divide two numbers in awk, using integer division, i.e truncating the result. For example k = 3 / 2 print k should print 1 According to the manual, Division; because all numbers ...
Yamashita asked 13/2, 2013 at 16:27

2

I would like to encapsulate a user-provided ERE in parenthesis while retaining its original meaning when I use it with awk's match, split, sub, etc... If you wonder why I want to do that then you c...
Recreant asked 29/5 at 19:2

4

Solved

I'm trying to implement an awk function for splitting a string into an array; the fundamental difference with the built-in split is that one is able to limit the number of "splits" that a...
Catchfly asked 27/5 at 14:35

6

Solved

Let's say that you have a file which contains N whitespace-delimited columns and an additional column which has spaces in it that you want to keep. Example with N = 2: 1.1 1.2 data for row1 2.1 2....
Managua asked 26/5 at 8:0

8

Solved

I want to input a string name (i.e. "COL2") to an awk or cut command and print the column that matches that column header string. the datafile looks like this: COL1 COL2 COL3 COL4 COL5 CO...
awk
Abednego asked 1/5, 2011 at 3:49

3

Solved

I am beginner to awk. I have created one file which contains employee information. There are employees in different departments. And i wanna count that how many employees in each department. like ...
Philis asked 27/9, 2016 at 11:39

© 2022 - 2024 — McMap. All rights reserved.