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?.

    5 novembre 2018 à 16:42:37 UTC+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

    12 octobre 2017 à 11:03:01 UTC+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
    2 août 2016 à 17:33:42 UTC+2 * - permalink - archive.org - http://stackoverflow.com/questions/6166375/median-of-column-with-awk
    awk median
  • micha/jsawk
    18 septembre 2015 à 12:30:06 UTC+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

    18 janvier 2015 à 14:45:25 UTC+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
    1 janvier 2015 à 14:40:56 UTC+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}'

    19 novembre 2014 à 14:54:22 UTC+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
    8 avril 2014 à 13:37:34 UTC+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

    16 décembre 2013 à 16:11:53 UTC+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

    7 décembre 2013 à 16:34:06 UTC+1 - permalink - archive.org - http://
    awk
  • http://www.pement.org/awk/awk1line.txt
    2 novembre 2013 à 09:14:12 UTC+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