Thursday, October 24, 2019

Convert tab delimited file into comma delimited on Mac


Need to convert tab delimited file to comma delimited on Mac.


Use sed utility, note that standard version doesn't understand \t, so you can either generate tab symbol by pressing Ctrl+V and Tab or install posix sed.

sed 's/ /,/g' <source file> > <target file>

Tuesday, October 22, 2019

Simple build script that works in Windows and Linux


Have two development environments:

MacOS, Visual Studio Professional for Mac, .NET Core 3.0

Windows 10, Visual Studio Professional for Windows, .NET Core 3.0

Need to write a script that will be working on Windows (.bat file) and MacOS (bash). 

For example sake, scripting languages or msbuild conditions should not be used.


Never thought that it's possible, definitely not an option for complex scenarios, but for basic commands go following (assuming that script build_webpack.cmd).

echo off

NODE=`which node`
cd "$(dirname "$0")/.."
$NODE ./node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js $@

goto $@

SET mypath=%~dp0
CD "%mypath:~0,-1%\\.."
node node_modules\\webpack\\bin\\webpack.js --config webpack.config.vendor.js %*

Now, if we need to invoke this script during project build, add the following line:

    <Exec Command="ClientApp/scripts/build_webpack.cmd" />