Skip to content

Latest commit

 

History

History
77 lines (47 loc) · 1.28 KB

README.md

File metadata and controls

77 lines (47 loc) · 1.28 KB

A simple implementaiton

Solution

Usage

A Go implementation of the GNU cat command.

Usage:

Example(s)

Checking the with the examples mentioned in the challenge

head -n1 test.txt | ./cat -

It is same as the output from cut, see

diff <(cut -f2 tests/testdata/sample.tsv) <(./cc-cut -f2 tests/testdata/sample.tsv)

A sample run for stdin,

echo "f1,f2,f3,f4\n1,2,3,4\na,b,c,d" | ./cc-cut -f1-2,3-4 -d, --output-delimiter=%
f1%f2%f3%f4
1%2%3%4
a%b%c%d

The output for the various options are same as that of the cit tool and it is verified using both Go tests and Functional tests

Development

Structure

Unit tests

    cd go/cat
    go test - v

Build

    cd go/cat
    go build -o cc-cat ./cmd

Function tests

The testdata is used which to compare alignment with cut to run the test use test.sh.

./test.sh -p ../cc-cat

References

Issues/Todo

There are same as the ones in the py-cat implementation, see