Thursday, September 30, 2021

Concatenate multiple files with same headers (and only keep one header line in the output file) - Version2

 Put this into an AWK script and call it merge.awk:


BEGIN{

    h=ARGV[1];

    ARGV[1]="";

}



{

    if(FNR==1){print}

    else if($1!~h){print}

}


and use an argument:

cat *.csv | awk -f merge.awk "<header>" > output.csv

Wednesday, September 8, 2021

git: find string in a certain branch

 So, today I cloned a repo and it has many branches. I know one of the branches has a file that is updated and contains the word "token". This is how I find out which branch it is:

git branch -a | cut -c3- | cut -d' ' -f 1 | xargs git grep "token" 

my-alpine and docker-compose.yml

 ``` version: '1' services:     man:       build: .       image: my-alpine:latest   ```  Dockerfile: ``` FROM alpine:latest ENV PYTH...