4337 links
  • Arnaud's links
  • Home
  • Login
  • RSS Feed
  • ATOM Feed
  • Tag cloud
  • Picture wall
  • Daily
Links per page: 20 50 100
page 1 / 1
11 results tagged awk x
  • thumbnail
    shell - How to select lines between two marker patterns which may occur multiple times with awk/sed - Stack Overflow

    Use awk with a flag to trigger the print when necessary:

    $ awk '/abc/{flag=1;next}/mno/{flag=0}flag' file
    def1
    ghi1
    jkl1
    def2
    ghi2
    jkl2

    How does this work?

    /abc/ matches lines having this text, as well as /mno/ does.
    /abc/{flag=1;next} sets the flag when the text abc is found. Then, it skips the line.
    /mno/{flag=0} unsets the flag when the text mno is found.
    The final flag is a pattern with the default action, which is to print $0: if flag is equal 1 the line is printed.

    For a more detailed description and examples, together with cases when the patterns are either shown or not, see How to select lines between two patterns?.

    November 5, 2018 at 4:42:37 PM GMT+1 - permalink - archive.org - https://stackoverflow.com/questions/17988756/how-to-select-lines-between-two-marker-patterns-which-may-occur-multiple-times-w
    awk
  • thumbnail
    shell - bash / sh script to replace text between some tags/strings in a text file - Unix & Linux Stack Exchange

    Use

    sed '/#start/,/#end/replace_command'

    For example, if the file is called myconfig, and you want to replace "allow" with "deny" in that section, you could say

    sed '/#start/,/#end/s/allow/deny/' myconfig

    example

    sed -i -r "/<elasticConfig>/,/<\/elasticConfig>/s,<enabled>.+</enabled>,<enabled>false</enabled>," file.xml

    October 12, 2017 at 11:03:01 AM GMT+2 * - permalink - archive.org - https://unix.stackexchange.com/questions/272061/bash-sh-script-to-replace-text-between-some-tags-strings-in-a-text-file
    awk replace sed
  • thumbnail
    bash - median of column with awk - Stack Overflow
    This awk program assumes one column of numerically sorted data:

    #/usr/bin/env awk
    {
        count[NR] = $1;
    }
    END {
        if (NR % 2) {
            print count[(NR + 1) / 2];
        } else {
            print (count[(NR / 2)] + count[(NR / 2) + 1]) / 2.0;
        }
    }

    Sample usage:

    sort -n data_file | awk -f median.awk
    August 2, 2016 at 5:33:42 PM GMT+2 * - permalink - archive.org - http://stackoverflow.com/questions/6166375/median-of-column-with-awk
    awk median
  • micha/jsawk
    September 18, 2015 at 12:30:06 PM GMT+2 - permalink - archive.org - https://github.com/micha/jsawk
    awk grep json
  • ferd.ca -> Awk in 20 Minutes

    Ce tuto est bien fait
    Mais j'ai un peu de mal avec awk : pour des tâches simple je m'en sors avec cut, et pour des tâches plus complexes je passe à un vrai langage de scripting comme python

    January 18, 2015 at 2:45:25 PM GMT+1 - permalink - archive.org - http://ferd.ca/awk-in-20-minutes.html
    awk
  • GNU Awk 4.1: Teaching an Old Bird Some New Tricks, Part II | Linux Journal
    January 1, 2015 at 2:40:56 PM GMT+1 - permalink - archive.org - http://www.linuxjournal.com/content/gnu-awk-41-teaching-old-bird-some-new-tricks-part-ii
    awk
  • thumbnail
    linux - Add up a column of numbers at the Unix shell - Stack Overflow

    | awk '{total = total + $1}END{print total}'

    find . ! -newer /tmp/file2015 -exec ls -l --block-size=M {} \; |cut -d' ' -f5|sed 's/M//'| awk '{total = total + $1}END{print total}'

    November 19, 2014 at 2:54:22 PM GMT+1 * - permalink - archive.org - http://stackoverflow.com/questions/926069/add-up-a-column-of-numbers-at-the-unix-shell
    add awk count sum total
  • Awk - A Tutorial and Introduction - by Bruce Barnett
    April 8, 2014 at 1:37:34 PM GMT+2 - permalink - archive.org - http://www.grymoire.com/Unix/Awk.html#uh-0
    awk
  • The UNIX School: awk - 10 examples to split a file into multiple files

    exemple de split file avec awk

    December 16, 2013 at 4:11:53 PM GMT+1 - permalink - archive.org - http://www.theunixschool.com/2012/06/awk-10-examples-to-split-file-into.html
    awk split
  • Awk

    Relink, je les avais perdu :
    Part 1 : http://www.linuxjournaldigital.com/linuxjournal/201109#pg94
    Part 2 : http://www.linuxjournal.com/content/gnu-awk-41-teaching-old-bird-some-new-tricks-part-ii

    December 7, 2013 at 4:34:06 PM GMT+1 - permalink - archive.org - http://
    awk
  • http://www.pement.org/awk/awk1line.txt
    November 2, 2013 at 9:14:12 AM GMT+1 - permalink - archive.org - http://www.pement.org/awk/awk1line.txt
    awk memo
Links per page: 20 50 100
page 1 / 1
Shaarli - The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community - Help/documentation