From 07158321eeecbcddd6e336ed7c0525403b190362 Mon Sep 17 00:00:00 2001 From: Nathan Handler Date: Sun, 27 May 2018 23:09:18 -0700 Subject: [PATCH] Add example converting tsv to csv Add an example of how to convert a tab-separted file to a comma-separated file (https://stackoverflow.com/a/22421445) --- slides.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/slides.txt b/slides.txt index 60b7524..36a6c2f 100644 --- a/slides.txt +++ b/slides.txt @@ -286,6 +286,11 @@ @last awk '$NF > 4' # print lines where last field is more than 4 +@last +. + # convert a tab-separated file to a comma-separated file + awk 'BEGIN { FS="\t"; OFS="," } {$1=$1; print}' file.tsv > file.csv + @last . # print number of lines matching 'Foo'