Tag: script

  • Get N matches using grep

    Here is the test data that we gonna use:

    >grep create *.log
    1.log:create1
    1.log:create2
    10.log:create1
    10.log:create2
    2.log:create1
    2.log:create2
    3.log:create1
    3.log:create2
    4.log:create1
    4.log:create2
    5.log:create1
    5.log:create2
    6.log:create1
    6.log:create2
    7.log:create1
    7.log:create2
    8.log:create1
    8.log:create2
    9.log:create1
    9.log:create2
    >
    

    Finding the First N matches
    (more…)

  • Faster way to extract file name

    Working with unix shell and no way you wont end up extracting file names from paths. Well there is a usual way to do it.

    >basename /my/big/long/path/to/a/little/bitty/file
    file
    

    Here is another way:

    (more…)